Run codecheck script on FUNCovsdbtest
Change-Id: Ieb09ac40b7fae0a569a5bb362e55a23b400e1e7e
diff --git a/TestON/tests/FUNC/FUNCovsdbtest/dependencies/Nbdata.py b/TestON/tests/FUNC/FUNCovsdbtest/dependencies/Nbdata.py
index 3fde20d..6c8725e 100644
--- a/TestON/tests/FUNC/FUNCovsdbtest/dependencies/Nbdata.py
+++ b/TestON/tests/FUNC/FUNCovsdbtest/dependencies/Nbdata.py
@@ -4,9 +4,10 @@
"""
import json
+
class NetworkData:
- def __init__(self):
+ def __init__( self ):
self.id = ''
self.state = 'ACTIVE'
self.name = 'onosfw-1'
@@ -14,76 +15,77 @@
self.admin_state_up = True
self.tenant_id = ''
self.routerExternal = False
- self.type ='LOCAL'
+ self.type = 'LOCAL'
self.segmentationID = '6'
self.shared = False
- def DictoJson(self):
+ def DictoJson( self ):
- if self.id =='' or self.tenant_id == '':
+ if self.id == '' or self.tenant_id == '':
print 'Id and tenant id is necessary!'
Dicdata = {}
- if self.id !='':
- Dicdata['id'] = self.id
+ if self.id != '':
+ Dicdata[ 'id' ] = self.id
if self.state != '':
- Dicdata['status'] = self.state
- if self.name !='':
- Dicdata['name'] = self.name
- if self.physicalNetwork !='':
- Dicdata['provider:physical_network'] = self.physicalNetwork
- if self.admin_state_up !='':
- Dicdata['admin_state_up'] = self.admin_state_up
- if self.tenant_id !='':
- Dicdata['tenant_id'] = self.tenant_id
- if self.routerExternal !='':
- Dicdata['router:external'] = self.routerExternal
- if self.type !='':
- Dicdata['provider:network_type'] = self.type
- if self.segmentationID !='':
- Dicdata['provider:segmentation_id'] = self.segmentationID
- if self.shared !='':
- Dicdata['shared'] = self.shared
+ Dicdata[ 'status' ] = self.state
+ if self.name != '':
+ Dicdata[ 'name' ] = self.name
+ if self.physicalNetwork != '':
+ Dicdata[ 'provider:physical_network' ] = self.physicalNetwork
+ if self.admin_state_up != '':
+ Dicdata[ 'admin_state_up' ] = self.admin_state_up
+ if self.tenant_id != '':
+ Dicdata[ 'tenant_id' ] = self.tenant_id
+ if self.routerExternal != '':
+ Dicdata[ 'router:external' ] = self.routerExternal
+ if self.type != '':
+ Dicdata[ 'provider:network_type' ] = self.type
+ if self.segmentationID != '':
+ Dicdata[ 'provider:segmentation_id' ] = self.segmentationID
+ if self.shared != '':
+ Dicdata[ 'shared' ] = self.shared
- Dicdata = {'network': Dicdata}
+ Dicdata = { 'network': Dicdata }
- return json.dumps(Dicdata,indent=4)
+ return json.dumps( Dicdata, indent=4 )
- def Ordered(self,obj):
+ def Ordered( self, obj ):
- if isinstance(obj, dict):
- return sorted((k,self.Ordered(v)) for k, v in obj.items())
- if isinstance(obj, list):
- return sorted(self.Ordered(x) for x in obj )
+ if isinstance( obj, dict ):
+ return sorted( ( k, self.Ordered( v ) ) for k, v in obj.items() )
+ if isinstance( obj, list ):
+ return sorted( self.Ordered( x ) for x in obj )
else:
return obj
- def JsonCompare(self,SourceData,DestiData,FirstPara,SecondPara):
+ def JsonCompare( self, SourceData, DestiData, FirstPara, SecondPara ):
try:
- SourceCompareDataDic = json.loads(SourceData)
- DestiCompareDataDic = json.loads(DestiData)
+ SourceCompareDataDic = json.loads( SourceData )
+ DestiCompareDataDic = json.loads( DestiData )
except ValueError:
print "SourceData or DestData is not JSON Type!"
return False
try:
- Socom = SourceCompareDataDic[FirstPara][SecondPara]
- Decom = DestiCompareDataDic[FirstPara][SecondPara]
- except KeyError,error:
- print "Key error ,This key is not found:%s"%error
+ Socom = SourceCompareDataDic[ FirstPara ][ SecondPara ]
+ Decom = DestiCompareDataDic[ FirstPara ][ SecondPara ]
+ except KeyError as error:
+ print "Key error ,This key is not found:%s" % error
return False
- if str(Socom).lower()== str(Decom).lower():
+ if str( Socom ).lower() == str( Decom ).lower():
return True
else:
- print "Source Compare data:"+FirstPara+"."+SecondPara+"="+str(Socom)
- print "Dest Compare data: "+FirstPara+"."+SecondPara+"="+str(Decom)
+ print "Source Compare data:" + FirstPara + "." + SecondPara + "=" + str( Socom )
+ print "Dest Compare data: " + FirstPara + "." + SecondPara + "=" + str( Decom )
return False
-class SubnetData(NetworkData):
- def __init__(self):
+class SubnetData( NetworkData ):
+
+ def __init__( self ):
self.id = ''
self.tenant_id = ''
self.network_id = ''
@@ -101,59 +103,60 @@
self.shared = False
self.name = 'demo-subnet'
- def DictoJson(self):
- if self.id =='' or self.tenant_id == '':
+ def DictoJson( self ):
+ if self.id == '' or self.tenant_id == '':
print 'Id and tenant id is necessary!'
Dicdata = {}
host_routesdata = []
- host_routesdata.append({'nexthop': self.nexthop,'destination': self.destination})
+ host_routesdata.append( { 'nexthop': self.nexthop, 'destination': self.destination } )
allocation_pools = []
- allocation_pools.append({'start': self.start,'end':self.end})
+ allocation_pools.append( { 'start': self.start, 'end': self.end } )
if self.id != '':
- Dicdata['id'] = self.id
+ Dicdata[ 'id' ] = self.id
if self.network_id != '':
- Dicdata['network_id'] = self.network_id
+ Dicdata[ 'network_id' ] = self.network_id
if self.name != '':
- Dicdata['name'] = self.name
+ Dicdata[ 'name' ] = self.name
if self.nexthop != '':
- Dicdata['host_routes'] = host_routesdata
+ Dicdata[ 'host_routes' ] = host_routesdata
if self.tenant_id != '':
- Dicdata['tenant_id'] = self.tenant_id
+ Dicdata[ 'tenant_id' ] = self.tenant_id
if self.start != '':
- Dicdata['allocation_pools'] = allocation_pools
+ Dicdata[ 'allocation_pools' ] = allocation_pools
if self.shared != '':
- Dicdata['shared'] = self.shared
+ Dicdata[ 'shared' ] = self.shared
if self.ipv6_address_mode != '':
- Dicdata['ipv6_address_mode'] = self.ipv6_address_mode
+ Dicdata[ 'ipv6_address_mode' ] = self.ipv6_address_mode
if self.ipv6_ra_mode != '':
- Dicdata['ipv6_ra_mode'] = self.ipv6_ra_mode
+ Dicdata[ 'ipv6_ra_mode' ] = self.ipv6_ra_mode
if self.cidr != '':
- Dicdata['cidr'] = self.cidr
+ Dicdata[ 'cidr' ] = self.cidr
if self.enable_dhcp != '':
- Dicdata['enable_dhcp'] = self.enable_dhcp
+ Dicdata[ 'enable_dhcp' ] = self.enable_dhcp
if self.dns_nameservers != '':
- Dicdata['dns_nameservers'] = self.dns_nameservers
+ Dicdata[ 'dns_nameservers' ] = self.dns_nameservers
if self.gateway_ip != '':
- Dicdata['gateway_ip'] = self.gateway_ip
+ Dicdata[ 'gateway_ip' ] = self.gateway_ip
if self.ip_version != '':
- Dicdata['ip_version'] = self.ip_version
+ Dicdata[ 'ip_version' ] = self.ip_version
- Dicdata = {'subnet': Dicdata}
+ Dicdata = { 'subnet': Dicdata }
- return json.dumps(Dicdata,indent=4)
+ return json.dumps( Dicdata, indent=4 )
-class VirtualPortData(NetworkData):
- def __init__(self):
+class VirtualPortData( NetworkData ):
+
+ def __init__( self ):
self.id = ''
self.state = 'ACTIVE'
self.bindingHostId = 'fa:16:3e:76:8e:88'
- self.allowedAddressPairs = [{'mac_address':'fa:16:3e:76:8e:88','ip_address':'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.securityGroups = [ { 'securityGroup': 'asd' } ]
self.adminStateUp = True
self.network_id = ''
self.tenant_id = ''
@@ -165,48 +168,48 @@
self.deviceId = 'a08aa'
self.name = 'u'
- def DictoJson(self):
+ def DictoJson( self ):
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({'subnet_id':self.subnet_id,'ip_address':'192.168.1.4'})
+ fixedIp = []
+ fixedIp.append( { 'subnet_id': self.subnet_id, 'ip_address': '192.168.1.4' } )
allocation_pools = []
if self.id != '':
- Dicdata['id'] = self.id
+ Dicdata[ 'id' ] = self.id
if self.state != '':
- Dicdata['status'] = self.state
+ Dicdata[ 'status' ] = self.state
if self.bindingHostId != '':
- Dicdata['binding:host_id'] = self.bindingHostId
+ Dicdata[ 'binding:host_id' ] = self.bindingHostId
if self.allowedAddressPairs != '':
- Dicdata['allowed_address_pairs'] = self.allowedAddressPairs
+ Dicdata[ 'allowed_address_pairs' ] = self.allowedAddressPairs
if self.deviceOwner != '':
- Dicdata['device_owner'] = self.deviceOwner
+ Dicdata[ 'device_owner' ] = self.deviceOwner
if self.securityGroups != '':
- Dicdata['security_groups'] = self.securityGroups
+ Dicdata[ 'security_groups' ] = self.securityGroups
if self.adminStateUp != '':
- Dicdata['admin_state_up'] = self.adminStateUp
+ Dicdata[ 'admin_state_up' ] = self.adminStateUp
if self.network_id != '':
- Dicdata['network_id'] = self.network_id
+ Dicdata[ 'network_id' ] = self.network_id
if self.tenant_id != '':
- Dicdata['tenant_id'] = self.tenant_id
+ Dicdata[ 'tenant_id' ] = self.tenant_id
if self.bindingvifDetails != '':
- Dicdata['binding:vif_details'] = self.bindingvifDetails
+ Dicdata[ 'binding:vif_details' ] = self.bindingvifDetails
if self.bindingvnicType != '':
- Dicdata['binding:vnic_type'] = self.bindingvnicType
+ Dicdata[ 'binding:vnic_type' ] = self.bindingvnicType
if self.bindingvifType != '':
- Dicdata['binding:vif_type'] = self.bindingvifType
+ Dicdata[ 'binding:vif_type' ] = self.bindingvifType
if self.macAddress != '':
- Dicdata['mac_address'] = self.macAddress
+ Dicdata[ 'mac_address' ] = self.macAddress
if self.deviceId != '':
- Dicdata['device_id'] = self.deviceId
+ Dicdata[ 'device_id' ] = self.deviceId
if self.name != '':
- Dicdata['name'] = self.name
+ Dicdata[ 'name' ] = self.name
- Dicdata['fixed_ips'] = fixedIp
- Dicdata = {'port': Dicdata}
+ Dicdata[ 'fixed_ips' ] = fixedIp
+ Dicdata = { 'port': Dicdata }
- return json.dumps(Dicdata,indent=4)
+ return json.dumps( Dicdata, indent=4 )