Merge "Populate 'security_groups' field from pre-existing port"
This commit is contained in:
commit
84dd0dc361
@ -192,6 +192,13 @@ class KuryrNetwork(network.Network):
|
|||||||
# We might revisit this behaviour later. Alternatively, we could
|
# We might revisit this behaviour later. Alternatively, we could
|
||||||
# either throw an exception or overwrite the port's security
|
# either throw an exception or overwrite the port's security
|
||||||
# groups.
|
# groups.
|
||||||
|
if not container.security_groups:
|
||||||
|
container.security_groups = []
|
||||||
|
if neutron_port['security_groups']:
|
||||||
|
for sg in neutron_port['security_groups']:
|
||||||
|
if sg not in container.security_groups:
|
||||||
|
container.security_groups += [sg]
|
||||||
|
container.save(self.context)
|
||||||
|
|
||||||
# update device_id in port
|
# update device_id in port
|
||||||
port_req_body = {'port': {'device_id': container.uuid}}
|
port_req_body = {'port': {'device_id': container.uuid}}
|
||||||
|
@ -46,7 +46,8 @@ class FakeNeutronClient(object):
|
|||||||
|
|
||||||
def get_neutron_port(self, port_id):
|
def get_neutron_port(self, port_id):
|
||||||
return {'fixed_ips': [{'ip_address': '192.168.2.22'}],
|
return {'fixed_ips': [{'ip_address': '192.168.2.22'}],
|
||||||
'id': '1234567'}
|
'id': '1234567',
|
||||||
|
'security_groups': []}
|
||||||
|
|
||||||
def get_neutron_network(self, network_id):
|
def get_neutron_network(self, network_id):
|
||||||
return {'shared': False}
|
return {'shared': False}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user