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):
links = {}
devices = {}
ports = {}
BasicDevConfigKeys = ['name', 'type', 'latitude', 'longitude', 'allowed',
'rackAddress', 'owner', 'driver', 'manufacturer',
'hwVersion', 'swVersion', 'serial',
'managementAddress']
for switch in LINCSwitch.opticalJSON[ 'devices' ]:
# Build device entries - keyed on uri (DPID) and config key 'basic'
......@@ -511,7 +515,7 @@ class LINCSwitch(OpticalSwitch):
# Annotations hold switch name and latitude/longitude
devDict = {}
devDict[ 'type' ] = switch[ 'type' ]
devDict.update(switch[ 'annotations' ])
devDict.update({k: v for k, v in switch[ 'annotations' ].iteritems() if k in BasicDevConfigKeys})
devSubj = switch[ 'uri' ]
devices[ devSubj ] = { 'basic': devDict }
......