something jacked up. fixed
@@ -237,3 +237,41 @@ def test_get_bymac():
answer = list([{'mac': '00:00:00:00:00:01', 'name': None,
'tenant': 'poseidon', 'segment': 'poseidon'}])
assert str(answer) == str(ret_val)
+
+def test_shutdown_ip():
+
+ class MockBcfProxy(BcfProxy):
+ def __init__(self):
+ self.endpoints = None
+
+ def get_endpoints(self):
+ return self.endpoints
+
+ 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
+ with HTTMock(mock_factory(r'.*', filemap)):
+ proxy = BcfProxy('http://localhost', 'login',
+ {'username': username, 'password': password})
+
+ endpoints = proxy.get_endpoints()
+
+ 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}])
+
+ assert str(answer) == str(ret_val)
+
