HIGUCHI Yuta
Committed by Gerrit Code Review

Limit fields added to BasicDeviceConfig

- Fixing opticalUtils.py, which was broken due to additional constraint added by
   Change-Id: I372e6c7e6c0fa6fa52301568af73342aaae6347b

Change-Id: I4233550c9e483448599a2dd501a50309ceb2e4c8
...@@ -504,6 +504,10 @@ class LINCSwitch(OpticalSwitch): ...@@ -504,6 +504,10 @@ class LINCSwitch(OpticalSwitch):
504 links = {} 504 links = {}
505 devices = {} 505 devices = {}
506 ports = {} 506 ports = {}
507 + BasicDevConfigKeys = ['name', 'type', 'latitude', 'longitude', 'allowed',
508 + 'rackAddress', 'owner', 'driver', 'manufacturer',
509 + 'hwVersion', 'swVersion', 'serial',
510 + 'managementAddress']
507 511
508 for switch in LINCSwitch.opticalJSON[ 'devices' ]: 512 for switch in LINCSwitch.opticalJSON[ 'devices' ]:
509 # Build device entries - keyed on uri (DPID) and config key 'basic' 513 # Build device entries - keyed on uri (DPID) and config key 'basic'
...@@ -511,7 +515,7 @@ class LINCSwitch(OpticalSwitch): ...@@ -511,7 +515,7 @@ class LINCSwitch(OpticalSwitch):
511 # Annotations hold switch name and latitude/longitude 515 # Annotations hold switch name and latitude/longitude
512 devDict = {} 516 devDict = {}
513 devDict[ 'type' ] = switch[ 'type' ] 517 devDict[ 'type' ] = switch[ 'type' ]
514 - devDict.update(switch[ 'annotations' ]) 518 + devDict.update({k: v for k, v in switch[ 'annotations' ].iteritems() if k in BasicDevConfigKeys})
515 devSubj = switch[ 'uri' ] 519 devSubj = switch[ 'uri' ]
516 devices[ devSubj ] = { 'basic': devDict } 520 devices[ devSubj ] = { 'basic': devDict }
517 521
......