Add security_group_find to neutron driver
Add security_group_find to neutron driver Change-Id: I69f74e5572f42a8768b15258727ab6d47983c6b1
This commit is contained in:
parent
8d072dc3ca
commit
52953fac09
|
@ -31,6 +31,11 @@ class NeutronClient(base.DriverBase):
|
||||||
port = self.conn.network.find_port(name_or_id, ignore_missing)
|
port = self.conn.network.find_port(name_or_id, ignore_missing)
|
||||||
return port
|
return port
|
||||||
|
|
||||||
|
@sdk.translate_exception
|
||||||
|
def security_group_find(self, name_or_id, ignore_missing=False):
|
||||||
|
sg = self.conn.network.find_security_group(name_or_id, ignore_missing)
|
||||||
|
return sg
|
||||||
|
|
||||||
@sdk.translate_exception
|
@sdk.translate_exception
|
||||||
def subnet_get(self, name_or_id, ignore_missing=False):
|
def subnet_get(self, name_or_id, ignore_missing=False):
|
||||||
subnet = self.conn.network.find_subnet(name_or_id, ignore_missing)
|
subnet = self.conn.network.find_subnet(name_or_id, ignore_missing)
|
||||||
|
|
|
@ -53,6 +53,16 @@ class TestNeutronV2Driver(base.SenlinTestCase):
|
||||||
self.conn.network.find_port.assert_called_once_with(port_id, False)
|
self.conn.network.find_port.assert_called_once_with(port_id, False)
|
||||||
self.assertEqual(port_obj, res)
|
self.assertEqual(port_obj, res)
|
||||||
|
|
||||||
|
def test_security_group_find(self):
|
||||||
|
sg_id = 'sg_identifier'
|
||||||
|
sg_obj = mock.Mock()
|
||||||
|
|
||||||
|
self.conn.network.find_security_group.return_value = sg_obj
|
||||||
|
res = self.nc.security_group_find(sg_id)
|
||||||
|
self.conn.network.find_security_group.assert_called_once_with(
|
||||||
|
sg_id, False)
|
||||||
|
self.assertEqual(sg_obj, res)
|
||||||
|
|
||||||
def test_subnet_get(self):
|
def test_subnet_get(self):
|
||||||
subnet_id = 'subnet_identifier'
|
subnet_id = 'subnet_identifier'
|
||||||
subnet_obj = mock.Mock()
|
subnet_obj = mock.Mock()
|
||||||
|
|
Loading…
Reference in New Issue