Merge "ONOS-2001 Test Case 15 now aborts using main.skipCase() when elections app isn't loaded on a node"
diff --git a/TestON/tests/FUNCvirNetNB/FUNCvirNetNB.py b/TestON/tests/FUNCvirNetNB/FUNCvirNetNB.py
index b8c592c..4d65bc6 100644
--- a/TestON/tests/FUNCvirNetNB/FUNCvirNetNB.py
+++ b/TestON/tests/FUNCvirNetNB/FUNCvirNetNB.py
@@ -287,10 +287,10 @@
network = NetworkData()
network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc'
network.tenant_id = '26cd996094344a0598b0a1af1d525cdc'
- network.shared = 'false'
+ network.shared = False
postdata = network.DictoJson()
- network.shared = 'true'
+ network.shared = True
postdatanew = network.DictoJson()
main.step( "Post Data via HTTP" )
@@ -392,7 +392,7 @@
expect='200',
actual=Deletestatus,
onpass="Delete Success",
- onfail="Delete Failed " + str( Getstatus ) + str( result ) )
+ onfail="Delete Failed " + str( Deletestatus ) + str( result ) )
main.step( "Get Data is NULL" )
Getstatus, result = main.ONOSrest.send( ctrlip, port, network.id, path+'networks/',
@@ -669,10 +669,342 @@
Getstatus, result = main.ONOSrest.send( ctrlip, port, subnet.id, path + 'subnets/',
'GET', None, None )
utilities.assert_equals(
- expect='the subnet does not exists',
+ expect='The subnet does not exists',
actual=result,
onpass="Get Subnet Success",
onfail="Get Subnet Failed " + str( Getstatus ) + str( result ) )
- if result != 'the subnet does not exists':
- main.log.error( "Delete Subnet failed" )
\ No newline at end of file
+ if result != 'The subnet does not exists':
+ main.log.error( "Delete Subnet failed" )
+
+ def CASE8( self, main ):
+
+ """
+ Test Post Port
+ """
+ import os
+
+ try:
+ from tests.FUNCvirNetNB.dependencies.Nbdata import NetworkData
+ from tests.FUNCvirNetNB.dependencies.Nbdata import SubnetData
+ from tests.FUNCvirNetNB.dependencies.Nbdata import VirtualPortData
+ except ImportError:
+ main.log.exception( "Something wrong with import file or code error." )
+ main.log.info( "Import Error, please check!" )
+ main.cleanup()
+ main.exit()
+
+ main.log.info( "ONOS Port Post test Start" )
+ main.case( "Virtual Network NBI Test - Port" )
+ main.caseExplanation = "Test Port Post NBI " +\
+ "Verify Stored Data is same with Post Data"
+
+ ctrlip = os.getenv( main.params['CTRL']['ip1'] )
+ httpport = main.params['HTTP']['port']
+ path = main.params['HTTP']['path']
+
+ main.step( "Generate Post Data" )
+ network = NetworkData()
+ network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc'
+ network.tenant_id = '26cd996094344a0598b0a1af1d525cdc'
+ subnet = SubnetData()
+ subnet.id = "e44bd655-e22c-4aeb-b1e9-ea1606875178"
+ subnet.tenant_id = network.tenant_id
+ subnet.network_id = network.id
+ port = VirtualPortData()
+ port.id = "9352e05c-58b8-4f2c-b4df-c20435ser56466"
+ port.subnet_id = subnet.id
+ port.tenant_id = network.tenant_id
+ port.network_id = network.id
+
+ networkpostdata = network.DictoJson()
+ subnetpostdata = subnet.DictoJson()
+ portpostdata = port.DictoJson()
+
+ main.step( "Post Network Data via HTTP(Post port need post network)" )
+ Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'networks/',
+ 'POST', None, networkpostdata )
+ utilities.assert_equals(
+ expect='200',
+ actual=Poststatus,
+ onpass="Post Network Success",
+ onfail="Post Network Failed " + str( Poststatus ) + "," + str( result ) )
+
+ main.step( "Post Subnet Data via HTTP(Post port need post subnet)" )
+ Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'subnets/',
+ 'POST', None, subnetpostdata )
+ utilities.assert_equals(
+ expect='202',
+ actual=Poststatus,
+ onpass="Post Subnet Success",
+ onfail="Post Subnet Failed " + str( Poststatus ) + "," + str( result ) )
+
+ main.step( "Post Port Data via HTTP" )
+ Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'ports/',
+ 'POST', None, portpostdata )
+ utilities.assert_equals(
+ expect='200',
+ actual=Poststatus,
+ onpass="Post Port Success",
+ onfail="Post Port Failed " + str( Poststatus ) + "," + str( result ) )
+
+ main.step( "Get Port Data via HTTP" )
+ Getstatus, result = main.ONOSrest.send( ctrlip, httpport, port.id, path + 'ports/',
+ 'GET', None, None )
+ utilities.assert_equals(
+ expect='200',
+ actual=Getstatus,
+ onpass="Get Port Success",
+ onfail="Get Port Failed " + str( Getstatus ) + "," + str( result ) )
+
+ main.step( "Compare Post Port Data" )
+ IDcmpresult = subnet.JsonCompare( portpostdata, result, 'port', 'id' )
+ TanantIDcmpresult = subnet.JsonCompare( portpostdata, result, 'port', 'tenant_id' )
+ NetoworkIDcmpresult = subnet.JsonCompare( portpostdata, result, 'port', 'network_id' )
+ fixedIpresult = subnet.JsonCompare( portpostdata, result, 'port', 'fixed_ips' )
+
+ Cmpresult = IDcmpresult and TanantIDcmpresult and NetoworkIDcmpresult and fixedIpresult
+ utilities.assert_equals(
+ expect=True,
+ actual=Cmpresult,
+ onpass="Compare Success",
+ onfail="Compare Failed:ID compare:" + str( IDcmpresult ) + \
+ ",Tenant id compare:"+ str( TanantIDcmpresult ) + \
+ ",Network id compare:" + str( NetoworkIDcmpresult ) +\
+ ",FixIp compare:" + str( fixedIpresult ) )
+
+ main.step( "Clean Data via HTTP" )
+ deletestatus,result = main.ONOSrest.send( ctrlip, httpport, network.id, path + 'networks/',
+ 'DELETE', None, None )
+ utilities.assert_equals(
+ expect='200',
+ actual=deletestatus,
+ onpass="Delete Network Success",
+ onfail="Delete Network Failed" )
+
+ if Cmpresult != True:
+ main.log.error( "Post port compare failed" )
+
+ def CASE9( self, main ):
+
+ """
+ Test Update Port
+ """
+ import os
+
+ try:
+ from tests.FUNCvirNetNB.dependencies.Nbdata import NetworkData
+ from tests.FUNCvirNetNB.dependencies.Nbdata import SubnetData
+ from tests.FUNCvirNetNB.dependencies.Nbdata import VirtualPortData
+ except ImportError:
+ main.log.exception( "Something wrong with import file or code error." )
+ main.log.info( "Import Error, please check!" )
+ main.cleanup()
+ main.exit()
+
+ main.log.info( "ONOS Port Update test Start" )
+ main.case( "Virtual Network NBI Test - Port" )
+ main.caseExplanation = "Test Port Update NBI " +\
+ "Verify Stored Data is same with New Post Data"
+
+ ctrlip = os.getenv( main.params['CTRL']['ip1'] )
+ httpport = main.params['HTTP']['port']
+ path = main.params['HTTP']['path']
+
+ main.step( "Generate Post Data" )
+ network = NetworkData()
+ network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc'
+ network.tenant_id = '26cd996094344a0598b0a1af1d525cdc'
+ subnet = SubnetData()
+ subnet.id = "e44bd655-e22c-4aeb-b1e9-ea1606875178"
+ subnet.tenant_id = network.tenant_id
+ subnet.network_id = network.id
+ port = VirtualPortData()
+ port.id = "9352e05c-58b8-4f2c-b4df-c20435ser56466"
+ port.subnet_id = subnet.id
+ port.tenant_id = network.tenant_id
+ port.network_id = network.id
+ port.name = "onos"
+
+ networkpostdata = network.DictoJson()
+ subnetpostdata = subnet.DictoJson()
+ portpostdata = port.DictoJson()
+
+ #create update data
+ port.name = "onos-new"
+ newportpostdata = port.DictoJson()
+ #end
+
+ main.step( "Post Network Data via HTTP(Post port need post network)" )
+ Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'networks/',
+ 'POST', None, networkpostdata )
+ utilities.assert_equals(
+ expect='200',
+ actual=Poststatus,
+ onpass="Post Network Success",
+ onfail="Post Network Failed " + str( Poststatus ) + "," + str( result ) )
+
+ main.step( "Post Subnet Data via HTTP(Post port need post subnet)" )
+ Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'subnets/',
+ 'POST', None, subnetpostdata )
+ utilities.assert_equals(
+ expect='202',
+ actual=Poststatus,
+ onpass="Post Subnet Success",
+ onfail="Post Subnet Failed " + str( Poststatus ) + "," + str( result ) )
+
+ main.step( "Post Port Data via HTTP" )
+ Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'ports/',
+ 'POST', None, portpostdata )
+ utilities.assert_equals(
+ expect='200',
+ actual=Poststatus,
+ onpass="Post Port Success",
+ onfail="Post Port Failed " + str( Poststatus ) + "," + str( result ) )
+
+ main.step( "Update Port Data via HTTP" )
+ Poststatus, result = main.ONOSrest.send( ctrlip, httpport, port.id, path + 'ports/',
+ 'PUT', None, newportpostdata )
+ utilities.assert_equals(
+ expect='200',
+ actual=Poststatus,
+ onpass="Update Port Success",
+ onfail="Update Port Failed " + str( Poststatus ) + "," + str( result ) )
+
+ main.step( "Get Port Data via HTTP" )
+ Getstatus, result = main.ONOSrest.send( ctrlip, httpport, port.id, path + 'ports/',
+ 'GET', None, None )
+ utilities.assert_equals(
+ expect='200',
+ actual=Getstatus,
+ onpass="Get Port Success",
+ onfail="Get Port Failed " + str( Getstatus ) + "," + str( result ) )
+
+ main.step( "Compare Update Port Data" )
+ IDcmpresult = subnet.JsonCompare( portpostdata, result, 'port', 'id' )
+ TanantIDcmpresult = subnet.JsonCompare( portpostdata, result, 'port', 'tenant_id' )
+ NetoworkIDcmpresult = subnet.JsonCompare( portpostdata, result, 'port', 'network_id' )
+ Nameresult = subnet.JsonCompare( newportpostdata, result, 'port', 'name' )
+
+ Cmpresult = IDcmpresult and TanantIDcmpresult and NetoworkIDcmpresult and Nameresult
+ utilities.assert_equals(
+ expect=True,
+ actual=Cmpresult,
+ onpass="Compare Success",
+ onfail="Compare Failed:ID compare:" + str( IDcmpresult ) + \
+ ",Tenant id compare:"+ str( TanantIDcmpresult ) + \
+ ",Network id compare:" + str( NetoworkIDcmpresult ) + \
+ ",Name compare:" + str(Nameresult) )
+
+ main.step( "Clean Data via HTTP" )
+ deletestatus,result = main.ONOSrest.send( ctrlip, httpport, network.id, path + 'networks/',
+ 'DELETE', None, None )
+ utilities.assert_equals(
+ expect='200',
+ actual=deletestatus,
+ onpass="Delete Network Success",
+ onfail="Delete Network Failed" )
+
+ if Cmpresult != True:
+ main.log.error( "Update port compare failed" )
+
+ def CASE10( self, main ):
+
+ """
+ Test Delete Port
+ """
+ import os
+
+ try:
+ from tests.FUNCvirNetNB.dependencies.Nbdata import NetworkData
+ from tests.FUNCvirNetNB.dependencies.Nbdata import SubnetData
+ from tests.FUNCvirNetNB.dependencies.Nbdata import VirtualPortData
+ except ImportError:
+ main.log.exception( "Something wrong with import file or code error." )
+ main.log.info( "Import Error, please check!" )
+ main.cleanup()
+ main.exit()
+
+ main.log.info( "ONOS Port Delete test Start" )
+ main.case( "Virtual Network NBI Test - Port" )
+ main.caseExplanation = "Test Port Delete NBI " +\
+ "Verify port delete success"
+
+ ctrlip = os.getenv( main.params['CTRL']['ip1'] )
+ httpport = main.params['HTTP']['port']
+ path = main.params['HTTP']['path']
+
+ main.step( "Generate Post Data" )
+ network = NetworkData()
+ network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc'
+ network.tenant_id = '26cd996094344a0598b0a1af1d525cdc'
+ subnet = SubnetData()
+ subnet.id = "e44bd655-e22c-4aeb-b1e9-ea1606875178"
+ subnet.tenant_id = network.tenant_id
+ subnet.network_id = network.id
+ port = VirtualPortData()
+ port.id = "9352e05c-58b8-4f2c-b4df-c20435ser56466"
+ port.subnet_id = subnet.id
+ port.tenant_id = network.tenant_id
+ port.network_id = network.id
+
+ networkpostdata = network.DictoJson()
+ subnetpostdata = subnet.DictoJson()
+ portpostdata = port.DictoJson()
+
+ main.step( "Post Network Data via HTTP(Post port need post network)" )
+ Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'networks/',
+ 'POST', None, networkpostdata )
+ utilities.assert_equals(
+ expect='200',
+ actual=Poststatus,
+ onpass="Post Network Success",
+ onfail="Post Network Failed " + str( Poststatus ) + "," + str( result ) )
+
+ main.step( "Post Subnet Data via HTTP(Post port need post subnet)" )
+ Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'subnets/',
+ 'POST', None, subnetpostdata )
+ utilities.assert_equals(
+ expect='202',
+ actual=Poststatus,
+ onpass="Post Subnet Success",
+ onfail="Post Subnet Failed " + str( Poststatus ) + "," + str( result ) )
+
+ main.step( "Post Port Data via HTTP" )
+ Poststatus, result = main.ONOSrest.send( ctrlip, httpport, '', path + 'ports/',
+ 'POST', None, portpostdata )
+ utilities.assert_equals(
+ expect='200',
+ actual=Poststatus,
+ onpass="Post Port Success",
+ onfail="Post Port Failed " + str( Poststatus ) + "," + str( result ) )
+
+ main.step( "Delete Port Data via HTTP" )
+ Poststatus, result = main.ONOSrest.send( ctrlip, httpport, port.id, path + 'ports/',
+ 'Delete', None, None )
+ utilities.assert_equals(
+ expect='200',
+ actual=Poststatus,
+ onpass="Delete Port Success",
+ onfail="Delete Port Failed " + str( Poststatus ) + "," + str( result ) )
+
+ main.step( "Get Port Data is NULL" )
+ Getstatus, result = main.ONOSrest.send( ctrlip, httpport, port.id, path + 'ports/',
+ 'GET', None, None )
+ utilities.assert_equals(
+ expect='The virtualPort does not exists',
+ actual=result,
+ onpass="Get Port Success",
+ onfail="Get Port Failed " + str( Getstatus ) + "," + str( result ) )
+
+ if result != 'The virtualPort does not exists':
+ main.log.error( "Delete Port failed" )
+
+ main.step( "Clean Data via HTTP" )
+ deletestatus,result = main.ONOSrest.send( ctrlip, httpport, network.id, path + 'networks/',
+ 'DELETE', None, None )
+ utilities.assert_equals(
+ expect='200',
+ actual=deletestatus,
+ onpass="Delete Network Success",
+ onfail="Delete Network Failed" )
\ No newline at end of file
diff --git a/TestON/tests/FUNCvirNetNB/dependencies/Nbdata.py b/TestON/tests/FUNCvirNetNB/dependencies/Nbdata.py
index dadf6b2..df2121e 100644
--- a/TestON/tests/FUNCvirNetNB/dependencies/Nbdata.py
+++ b/TestON/tests/FUNCvirNetNB/dependencies/Nbdata.py
@@ -11,12 +11,12 @@
self.state = 'ACTIVE'
self.name = 'onosfw-1'
self.physicalNetwork = 'none'
- self.admin_state_up = 'true'
+ self.admin_state_up = True
self.tenant_id = ''
- self.routerExternal = 'false'
+ self.routerExternal = False
self.type ='LOCAL'
self.segmentationID = '6'
- self.shared = 'false'
+ self.shared = False
def DictoJson(self):
@@ -72,7 +72,7 @@
Decom = DestiCompareDataDic[FirstPara][SecondPara]
except KeyError,error:
print "Key error ,This key is not found:%s"%error
- return False
+ return False
if str(Socom).lower()== str(Decom).lower():
return True
@@ -94,11 +94,11 @@
self.ipv6_address_mode = 'DHCPV6_STATELESS'
self.ipv6_ra_mode = 'DHCPV6_STATELESS'
self.cidr = '192.168.1.1/24'
- self.enable_dhcp = 'true'
+ self.enable_dhcp = True
self.dns_nameservers = 'aaa'
self.gateway_ip = '192.168.2.1'
- self.ip_version = 'INET'
- self.shared = 'false'
+ self.ip_version = '4'
+ self.shared = False
self.name = 'demo-subnet'
def DictoJson(self):
@@ -150,14 +150,14 @@
self.id = ''
self.state = 'ACTIVE'
self.bindingHostId = 'fa:16:3e:76:8e:88'
- self.allowedAddressPairs = [{'macAddress':'fa:16:3e:76:8e:88','ipAddress':'192.168.1.1'}]
+ self.allowedAddressPairs = [{'mac_address':'fa:16:3e:76:8e:88','ip_address':'192.168.1.1'}]
self.deviceOwner = 'none'
self.fixedIp = []
self.securityGroups = [{'securityGroup':'asd'}]
- self.adminStateUp = 'true'
- self.networkId = ''
- self.tenantId = ''
- self.subnetId = ''
+ self.adminStateUp = True
+ self.network_id = ''
+ self.tenant_id = ''
+ self.subnet_id = ''
self.bindingvifDetails = 'port_filter'
self.bindingvnicType = 'normal'
self.bindingvifType = 'ovs'
@@ -166,49 +166,47 @@
self.name = 'u'
def DictoJson(self):
- if self.id == '' or self.tenant_id == ' ' or self.networkId == '':
+ if self.id == '' or self.tenant_id == ' ' or \
+ self.network_id == '' or self.subnet_id == '':
print 'Id/tenant id/networkid/subnetId is necessary!'
Dicdata = {}
fixedIp =[]
- fixedIp.append({'subnetId':self.subnetId,'ipAddress':'192.168.1.4'})
+ fixedIp.append({'subnet_id':self.subnet_id,'ip_address':'192.168.1.4'})
allocation_pools = []
if self.id != '':
Dicdata['id'] = self.id
if self.state != '':
- Dicdata['state'] = self.state
+ Dicdata['status'] = self.state
if self.bindingHostId != '':
- Dicdata['bindingHostId'] = self.bindingHostId
+ Dicdata['binding:host_id'] = self.bindingHostId
if self.allowedAddressPairs != '':
- Dicdata['allowedAddressPairs'] = self.allowedAddressPairs
+ Dicdata['allowed_address_pairs'] = self.allowedAddressPairs
if self.deviceOwner != '':
- Dicdata['deviceOwner'] = self.deviceOwner
- if self.fixedIp != []:
- Dicdata['fixedIp'] = fixedIp
+ Dicdata['device_owner'] = self.deviceOwner
if self.securityGroups != '':
- Dicdata['securityGroups'] = self.securityGroups
+ Dicdata['security_groups'] = self.securityGroups
if self.adminStateUp != '':
- Dicdata['adminStateUp'] = self.adminStateUp
- if self.networkId != '':
- Dicdata['networkId'] = self.networkId
- if self.tenantId != '':
- Dicdata['tenantId'] = self.tenantId
- if self.subnetId != '':
- Dicdata['subnetId'] = self.subnetId
+ Dicdata['admin_state_up'] = self.adminStateUp
+ if self.network_id != '':
+ Dicdata['network_id'] = self.network_id
+ if self.tenant_id != '':
+ Dicdata['tenant_id'] = self.tenant_id
if self.bindingvifDetails != '':
- Dicdata['bindingvifDetails'] = self.bindingvifDetails
+ Dicdata['binding:vif_details'] = self.bindingvifDetails
if self.bindingvnicType != '':
- Dicdata['bindingvnicType'] = self.bindingvnicType
+ Dicdata['binding:vnic_type'] = self.bindingvnicType
if self.bindingvifType != '':
- Dicdata['bindingvifType'] = self.bindingvifType
+ Dicdata['binding:vif_type'] = self.bindingvifType
if self.macAddress != '':
- Dicdata['macAddress'] = self.macAddress
+ Dicdata['mac_address'] = self.macAddress
if self.deviceId != '':
- Dicdata['deviceId'] = self.deviceId
+ Dicdata['device_id'] = self.deviceId
if self.name != '':
Dicdata['name'] = self.name
- Dicdata = {'virtualport': Dicdata}
+ Dicdata['fixed_ips'] = fixedIp
+ Dicdata = {'port': Dicdata}
- return json.dumps(Dicdata,indent=4)
\ No newline at end of file
+ return json.dumps(Dicdata,indent=4)
\ No newline at end of file