Test creation:bcf.py: unmiror_ip
@@ -238,6 +238,7 @@ def test_get_bymac():
'tenant': 'poseidon', 'segment': 'poseidon'}])
assert str(answer) == str(ret_val)
+
def test_shutdown_ip():
class MockBcfProxy(BcfProxy):
@@ -271,10 +272,12 @@ def test_shutdown_ip():
bcf.endpoints = endpoints
ret_val = bcf.shutdown_ip('10.0.0.1')
- answer = list([{'ip-address': '10.0.0.1', 'ip-state': 'learned', 'mac': '00:00:00:00:00:01', 'segment': 'poseidon', 'tenant': 'poseidon', 'name': None}])
+ answer = list([{'ip-address': '10.0.0.1', 'ip-state': 'learned', 'mac': '00:00:00:00:00:01',
+ 'segment': 'poseidon', 'tenant': 'poseidon', 'name': None}])
assert str(answer) == str(ret_val)
+
def test_get_highest():
class MockBcfProxy(BcfProxy):
@@ -407,3 +410,47 @@ def test_mirror_ip():
bcf.endpoints = endpoints
bcf.span_fabric = span_fabric
ret_val = bcf.mirror_ip('10.0.0.2')
+
+def test_unmirror_ip():
+
+ class MockBcfProxy(BcfProxy):
+ def __init__(self):
+ self.endpoints = None
+ self.span_fabric = None
+
+ def get_endpoints(self):
+ return self.endpoints
+
+ def mirror_traffic(self, seq, mirror=True, span_name='vent', s_dict=None, fabric_span_endpoint='', **target_kwargs):
+ pass
+
+ def get_span_fabric(self):
+ return self.span_fabric
+
+ def shutdown_endpoint(self, tenant, segment, name, mac, shutdown):
+ pass
+
+ bcf = MockBcfProxy()
+
+ filemap = {
+ '/data/controller/applications/bcf/info/fabric/switch': 'sample_switches.json',
+ '/data/controller/applications/bcf/info/endpoint-manager/tenant': 'sample_tenants.json',
+ '/data/controller/applications/bcf/info/endpoint-manager/segment': 'sample_segments.json',
+ '/data/controller/applications/bcf/info/endpoint-manager/endpoint': 'sample_endpoints.json',
+ '/data/controller/applications/bcf/span-fabric': 'sample_span_fabric.json',
+ # %22 = url-encoded double quotes
+ '/data/controller/applications/bcf/span-fabric[name=%22vent%22]': 'sample_span_fabric.json',
+ }
+ proxy = None
+ endpoints = None
+ span_fabric = None
+ with HTTMock(mock_factory(r'.*', filemap)):
+ proxy = BcfProxy('http://localhost', 'login',
+ {'username': username, 'password': password})
+
+ endpoints = proxy.get_endpoints()
+ span_fabric = proxy.get_span_fabric()
+
+ bcf.endpoints = endpoints
+ bcf.span_fabric = span_fabric
+ ret_val = bcf.unmirror_ip('10.0.0.2')
