Exemplo n.º 1
0
 def test_check_delete_route_exception(self):
     try:
          delete_route()
     except Exception as err:
         self.assertEqual(
             err.args[0],
             "device argument is mandatory")
Exemplo n.º 2
0
 def test_check_delete_route_network_exception(self):
     try:
         delete_route(
                 device=self.mocked_obj,
                 network="5.0.0.0")
     except Exception as err:
         self.assertEqual(
             err.args[0],
             "network and netmask are required to delete network based route")
Exemplo n.º 3
0
 def test_check_delete_route_ipv6_host_fail(self):
     lst = [Response(""),Response("2005::1/128                                         2005::254   \n")]
     get_ip_address_type=MagicMock(side_effect="ipv6")
     self.mocked_obj.shell = MagicMock(side_effect=lst)
     try:
         delete_route(
                 device=self.mocked_obj,
                 host="2005::1")
     except Exception as err:
         self.assertEqual(
             err.args[0],
             "Route is not deleted")
Exemplo n.º 4
0
 def test_check_delete_route_ipv4_host_fail(self):
     lst = [Response(""),Response("5.0.0.1         4.0.0.254   255.255.255.255         UG        0 0          0 eth0")]
     get_ip_address_type=MagicMock(side_effect="ipv4")
     self.mocked_obj.shell = MagicMock(side_effect=lst)
     try:
         delete_route(
                 device=self.mocked_obj,
                 host="5.0.0.1")
     except Exception as err:
         self.assertEqual(
             err.args[0],
             "Route is not deleted")
Exemplo n.º 5
0
 def test_check_delete_route_ipv6_default_gateway_fail(self):
     lst = [Response(""),Response("*/0                                         2006::2")]
     get_ip_address_type=MagicMock(side_effect="ipv6")
     self.mocked_obj.shell = MagicMock(side_effect=lst)
     try:
         delete_route(
                 device=self.mocked_obj,
                 default_gateway="2006::2")
     except Exception as err:
         self.assertEqual(
             err.args[0],
             "Route is not deleted")
Exemplo n.º 6
0
 def test_check_delete_route_ipv4_default_gateway_fail(self):
     lst = [Response(""),Response("0.0.0.0         10.209.95.254   0.0.0.0         UG        0 0          0 eth0")]
     get_ip_address_type=MagicMock(side_effect="ipv4")
     self.mocked_obj.shell = MagicMock(side_effect=lst)
     try:
         delete_route(
                 device=self.mocked_obj,
                 default_gateway="10.209.95.254")
     except Exception as err:
         self.assertEqual(
             err.args[0],
             "Route is not deleted")
Exemplo n.º 7
0
 def test_check_delete_route_ipv6_network_fail(self):
     lst = [Response(""),Response("2005::/64                                         2004::254")]
     get_ip_address_type=MagicMock(side_effect="ipv6")
     self.mocked_obj.shell = MagicMock(side_effect=lst)
     try:
         delete_route(
                 device=self.mocked_obj,
                 network="2005::",
                 gateway="2004::25",
                 netmask="64")
     except Exception as err:
         self.assertEqual(
             err.args[0],
             "Route is not deleted")
Exemplo n.º 8
0
 def test_check_delete_route_ipv6_host_success(self):
     lst = [Response(""),Response("2005::4/128                                         2005::254   \n")]
     get_ip_address_type=MagicMock(side_effect="ipv6")
     self.mocked_obj.shell = MagicMock(side_effect=lst)
     self.assertEqual(
          delete_route(
                  device=self.mocked_obj,
                  host="2005::1"),
                  True)
Exemplo n.º 9
0
 def test_check_delete_route_ipv4_host_success(self):
     lst = [Response(""),Response("6.0.0.1         4.0.0.254   255.255.255.255         UG        0 0          0 eth0")]
     get_ip_address_type=MagicMock(side_effect="ipv4")
     self.mocked_obj.shell = MagicMock(side_effect=lst)
     self.assertEqual(
          delete_route(
                  device=self.mocked_obj,
                  host="5.0.0.1"),
                  True)
Exemplo n.º 10
0
 def test_check_delete_route_ipv6_default_gateway_success(self):
     lst = [Response(""),Response("*/0                                         2006::1")]
     get_ip_address_type=MagicMock(side_effect="ipv6")
     self.mocked_obj.shell = MagicMock(side_effect=lst)
     self.assertEqual(
          delete_route(
                  device=self.mocked_obj,
                  default_gateway="2005::1"),
                  True)
Exemplo n.º 11
0
 def test_check_delete_route_ipv4_default_gateway_success(self):
     lst = [Response(""),Response("0.0.0.0         10.209.95.254   0.0.0.0         UG        0 0          0 eth0")]
     get_ip_address_type=MagicMock(side_effect="ipv4")
     self.mocked_obj.shell = MagicMock(side_effect=lst)
     self.assertEqual(
          delete_route(
                  device=self.mocked_obj,
                  default_gateway="10.209.9.254"),
                  True)
Exemplo n.º 12
0
 def test_check_delete_route_ipv6_network_success(self):
     lst = [Response(""),Response("2006::/64                                         2004::254 ")]
     get_ip_address_type=MagicMock(side_effect="ipv6")
     self.mocked_obj.shell = MagicMock(side_effect=lst)
     self.assertEqual(
          delete_route(
                  device=self.mocked_obj,
                  network="2005::",
                  gateway="2004::254",
                  netmask="64"),
                  True)
Exemplo n.º 13
0
 def test_check_delete_route_ipv4_network_success(self):
     lst = [Response(""),Response("6.0.0.0         4.0.0.254   255.0.0.0         UG        0 0          0 eth0")]
     get_ip_address_type=MagicMock(side_effect="ipv4")
     self.mocked_obj.shell = MagicMock(side_effect=lst)
     self.assertEqual(
          delete_route(
                  device=self.mocked_obj,
                  network="5.0.0.0",
                  gateway="4.0.0.254",
                  netmask="255.0.0.0"),
                  True)