예제 #1
0
 def test_configure_linux_tunnel_exception_1(self):
     try:
         linux_network_config.configure_linux_tunnel()
     except Exception as err:
         self.assertEqual(
             err.args[0],
              "device is mandatory argument")
     try:
         linux_network_config.configure_linux_tunnel(device=self.mocked_obj)
     except Exception as err:
         self.assertEqual(
             err.args[0],
              "remote address,local address,device interface\
             and tunnel name are mandatory arguments")
예제 #2
0
    def test_configure_linux_tunnel_exception_5(self):
        lst = [Response(""),Response("")]
        self.mocked_obj.shell = MagicMock(side_effect=lst)

        try:
            linux_network_config.configure_linux_tunnel(
                     device=self.mocked_obj,
                     remote_address="2002:2010::1401:1",
                     local_address="2002:2010::1401:65",
                     interface="eth1",
                     tunnel_name="dslite"),

        except Exception as err:
            self.assertEqual(
                err.args[0],
                "tunnel service module not up")
예제 #3
0
    def test_configure_linux_tunnel_exception_4(self):
        lst = [Response(""),Response("tun          17051  0")]
        self.mocked_obj.shell = MagicMock(side_effect=lst)

        try:
            linux_network_config.configure_linux_tunnel(
                     device=self.mocked_obj,
                     remote_address="2002:2010::1401:1",
                     local_address="2.1.1.1",
                     interface="eth1",
                     tunnel_name="dslite"),

        except Exception as err:
            self.assertEqual(
                err.args[0],
                "Remote and Local IP versions are not same")
예제 #4
0
    def test_configure_linux_tunnel_exception_3(self):
        lst = [Response(""),Response("tun                    17051  0"),Response(""),Response("ip6_tunnel             13489  0"),Response(""),Response(""),Response(""),Response("")]
        self.mocked_obj.shell = MagicMock(side_effect=lst)

        try:
            linux_network_config.configure_linux_tunnel(
                     device=self.mocked_obj,
                     remote_address="2002:2010::1401:1",
                     local_address="2002:2010::1401:65",
                     interface="eth1",
                     tunnel_name="dslite"),

        except Exception as err:
            self.assertEqual(
                err.args[0],
                "ipip6 tunnel is not added successfully")
예제 #5
0
 def test_configure_linux_tunnel_success_2(self):
     lst = [Response(""),Response("tun                    17051  0"),Response(""),Response("ip6_tunnel             13489  0"),Response(""),Response(""),Response(""),Response("dslite: ip/ipv6 remote 2002:2010::1401:1 local 2002:2010::1401:65 dev eth1")]
     self.mocked_obj.shell = MagicMock(side_effect=lst)
     self.assertEqual(
         linux_network_config.configure_linux_tunnel(
                  device=self.mocked_obj,
                  remote_address="2002:2010::1401:1",
                  local_address="2002:2010::1401:65",
                  interface="eth1",
                  tunnel_name="dslite"),
                  True)
예제 #6
0
 def test_configure_linux_tunnel_success_1(self):
     lst = [Response(""),Response("tun                    17051  0"),Response(""),Response("ipip                    8435  0"),Response(""),Response(""),Response(""),Response("dslite: ip/ip  remote 2.1.1.2  local 2.1.1.1  dev eth1")]
     self.mocked_obj.shell = MagicMock(side_effect=lst)
     self.assertEqual(
          linux_network_config.configure_linux_tunnel(
                  device=self.mocked_obj,
                  remote_address="2.1.1.2",
                  local_address="2.1.1.1",
                  interface="eth1",
                  tunnel_name="dslite"),
                  True)