Ejemplo n.º 1
0
 def test_add_existing_route(self, execute_command):
     execute_command.return_value = self.ip_route_list_output
     route = Route('default', 'wlo1')
     route.gateway = '192.168.0.254'
     with self.assertRaises(ObjectAlreadyExistsException):
         route.create()
         execute_command.assert_called_once_with('ip route list', namespace=None)
Ejemplo n.º 2
0
def step_impl(context, destination, device):
    route = Route(destination, device)
    if route not in Route.discover():
        route.create()
Ejemplo n.º 3
0
def step_impl(context, destination, device):
    route = Route(destination, device)
    try:
        route.create()
    except Exception as e:
        context.exception = e
Ejemplo n.º 4
0
 def test_add_non_existing_route(self, execute_command):
     execute_command.return_value = self.ip_route_list_output
     route = Route('1.2.3.4', 'wlo1')
     route.gateway = '192.168.0.254'
     route.create()
     execute_command.assert_called_with('ip route add 1.2.3.4 dev wlo1 via 192.168.0.254', namespace=None)