Пример #1
0
    def _start(self):
        # TODO: use ShellCommandSerializer
        tunnel_cmd = IPRoute2Commands.get_gretap_tunnel_cmd(self.get_tunnel_name(), self.remote_ip,
                                                            self.get_tunnel_id())

        log.info("creating gretap tunnel for %s<->%s" % (self.emulation_node_x.id, self.emulation_node_y.id))

        self.add_command(self.EVENT_TUNNEL_ADD, tunnel_cmd)

        log.info("changing NIC MTU to '%d' ... ", GRETAP_MTU)
        self.get_local_emulation_node().virtualization_layer.set_link_mtus(mtu=GRETAP_MTU)

        # set tunnel dev group
        super(GreTapTunnel, self)._start()
Пример #2
0
    def reset(self):
        """
        Raises
        ------
        NetworkBackendErrorReset

        Returns
        -------

        """
        try:
            if self.started and self.bridge_dev_name:
                self.run(
                    IPRoute2Commands.get_link_del_cmd(self.bridge_dev_name))

        except Exception as e:
            raise NetworkBackendErrorReset(
                """Could not shutdown the bridge '%s'
Interface dump:
%s
""" % (self, pformat(self.get_interfaces())),
                caused_by=e)
Пример #3
0
        def _tap_link_up(self, tap_x, tap_y, up=True):

            cmd = IPRoute2Commands.get_interface_up_cmd(tap_x, state_down=not up)
            self.add_shell_command(self.EVENT_CONN_STATE_CHANGE, cmd)
            # remember that the device is up (or down)
            singletons.network_backend.connection_book_keeper.interface_states.toggle_state(tap_x, up)
Пример #4
0
 def _shutdown(self):
     tunnel_cmd = IPRoute2Commands.get_link_del_cmd(self.get_tunnel_name())
     self.add_command(self.EVENT_TUNNEL_REMOVE, tunnel_cmd)
Пример #5
0
    def reset(self):
        from miniworld.model.network.backends.bridged.iproute2 import IPRoute2Commands

        self.run_shell(IPRoute2Commands.get_link_del_cmd(self.get_tunnel_name()))
Пример #6
0
 def _get_bridge_set_hub_mode_cmd(self):
     return IPRoute2Commands.get_bridge_set_hub_mode_cmd(
         self.bridge_dev_name)
Пример #7
0
 def _get_bridge_add_cmd(self):
     return IPRoute2Commands.get_bridge_add_cmd(self.bridge_dev_name)
Пример #8
0
 def _get_bridge_up_cmd(self, _if_name):
     return IPRoute2Commands.get_interface_up_cmd(_if_name)
Пример #9
0
 def _get_bridge_add_if_cmd(self, _if_name):
     return IPRoute2Commands.get_bridge_add_if_cmd(
         _if_name, self.bridge_dev_name)