3 Authors: Baohua Yang@IBM, Denghui Huang@IBM
10 from restlib import * # noqa
11 from testmodule import TestModule
16 class ArpHandler(TestModule):
18 Test for the arp handler.
19 Start 2-layer tree topology network. e.g., in Mininet, run
20 'sudo mn --controller=remote,ip=127.0.0.1 --mac --topo tree,2'
23 def __init__(self, restSubContext='/controller/nb/v2/subnetservice', user=DEFAULT_USER, password=DEFAULT_PWD,
24 container=DEFAULT_CONTAINER, contentType='json', prefix=DEFAULT_PREFIX):
25 super(self.__class__, self).__init__(restSubContext, user, password, container, contentType, prefix)
27 def get_subnets(self):
29 The name is suggested to match the NB API.
30 list all subnets and their properties.
32 return super(self.__class__, self).get_entries('subnets')
34 def add_subnet_gateway(self, name, body):
38 super(self.__class__, self).add_entry('subnet', name, body)
40 def remove_subnet_gateway(self, name):
42 Remove a subnet gateway.
44 super(self.__class__, self).remove_entry('subnet', name)
46 def test_subnet_operations(self, name, body):
48 Test subnet operations, like adding and removeing a subnet.
49 >>> ArpHandler().test_subnet_operations('test',{'name':'test','subnet':'10.0.0.254/8'})
52 return super(self.__class__, self).test_add_remove_operations('subnets', 'subnet', name, body, 'subnetConfig')
55 if __name__ == '__main__':