Example #1
0
        self.logger.info("stopping static tunnel '%s'" % self.name)

        gre.get(self.dry_run, self.logger, self.tunnel_name, self.mode, netns=self.netns).remove()

        self.logger.info("finished stopping static tunnel '%s'" % self.name)


    def remove(self):
        '''
        Remove the static tunnel.
        '''

        self.daemon.gre_key_remove(self.local, self.remote, self.key if self.key else self.ikey)

Interface.register(Tunnel)


def read(logger, name, config):
    '''
    Create a static tunnel from the given configuration object.
    '''

    mode = util.enum_get(config["mode"], ["gre", "gretap"])
    local = util.ip_address_get(config["local"])
    remote = util.ip_address_get(config["remote"])
    address = util.ip_address_get(config["address"])
    netmask = util.netmask_get(config["netmask"], util.ip_address_is_v6(address))

    key = util.integer_get(config["key"], minval=0) if "key" in config else None
    ikey = util.integer_get(config["ikey"], minval=0) if "ikey" in config else None
Example #2
0
        self.logger.info("stopping static vlan '%s'" % self.name)

        bridge.get(self.dry_run, self.logger, self.bridge_name, root_ipdb=self.root_ipdb).remove()
        veth.get(
            self.dry_run,
            self.logger,
            self.root_veth_name,
            self.netns_veth_name,
            root_ipdb = self.root_ipdb,
        ).remove()
        vlan.get(self.dry_run, self.logger, self.vlan_name, root_ipdb=self.root_ipdb).remove()

        self.logger.info("finished stopping static vlan '%s'" % self.name)

Interface.register(VLAN)


def read(logger, name, config):
    '''
    Create a static vlan from the given configuration object.
    '''

    id = util.integer_get(config["id"], minval=0, maxval=4096)
    physical_interface = util.name_get(config["physical-interface"])
    address = util.ip_address_get(config["address"])
    netmask = util.netmask_get(config["netmask"], util.ip_address_is_v6(address))

    return VLAN(logger, name,
            id, physical_interface, address, netmask)
Example #3
0
        self.logger.info("finished starting static tuntap '%s'" % self.name)


    def stop(self):
        '''
        Stop the static tuntap.
        '''

        self.logger.info("stopping static tuntap '%s'" % self.name)

        tuntap.get(self.dry_run, self.logger, self.tuntap_name, self.mode, netns=self.netns).remove()

        self.logger.info("finished stopping static tuntap '%s'" % self.name)

Interface.register(Tuntap)


def read(logger, name, config):
    '''
    Create a static tuntap from the given configuration object.
    '''

    mode = util.enum_get(config["mode"], ["tun", "tap"])
    address = util.ip_address_get(config["address"])
    netmask = util.netmask_get(config["netmask"], util.ip_address_is_v6(address))
    uid = util.integer_get(config["uid"], minval=0) if "uid" in config else None
    gid = util.integer_get(config["gid"], minval=0) if "gid" in config else None

    return Tuntap(logger, name,
            mode, address, netmask, uid, gid)
Example #4
0
        Stop the static overlay link.
        '''

        self.logger.info("stopping static overlay link '%s'" % self.name)

        self.inner_netns.start()

        bridge.get(self.dry_run, self.logger, self.bridge_name, netns=self.netns).remove()
        dummy.get(self.dry_run, self.logger, self.dummy_name, netns=self.netns).remove()
        veth.get(self.dry_run, self.logger, self.outer_name, self.inner_name, netns=self.netns).remove()

        self.inner_netns.stop()

        self.logger.info("finished stopping static overlay link '%s'" % self.name)

Interface.register(OverlayLink)


def read(logger, name, config):
    '''
    Create a static overlay link from the given configuration object.
    '''

    outer_address = util.ip_address_get(config["outer-address"])
    inner_address = util.ip_address_get(config["inner-address"])
    inner_overlay_name = util.name_get(config["inner-overlay-name"])
    netmask = util.netmask_get(config["netmask"], util.ip_address_is_v6(inner_address))

    if (type(inner_address) != type(outer_address)):
        raise ReadError("inner address '%s' (%s) and outer address '%s' (%s) must be the same type of IP address" %
                (inner_address, str(type(nner_address)),
Example #5
0
        self.logger.info("finished starting static dummy '%s'" % self.name)


    def stop(self):
        '''
        Stop the static dummy.
        '''

        self.logger.info("stopping static dummy '%s'" % self.name)

        dummy.get(self.dry_run, self.logger, self.dummy_name, netns=self.netns).remove()

        self.logger.info("finished stopping static dummy '%s'" % self.name)

Interface.register(Dummy)


def read(logger, name, config):
    '''
    Create a static dummy from the given configuration object.
    '''

    address = util.ip_address_get(config["address"])
    netmask = util.netmask_get(config["netmask"], util.ip_address_is_v6(address))

    return Dummy(logger, name,
            address, netmask)


def write(dummy, config):
Example #6
0
            self.netns_veth_name,
            root_ipdb=self.root_ipdb,
        ).remove()
        gre.get(self.dry_run, self.logger, self.name, "gretap", root_ipdb=self.root_ipdb).remove()

        self.logger.info("finished stopping mesh tunnel '%s'" % self.name)


    def remove(self):
        '''
        Remove the mesh tunnel.
        '''

        self.daemon.gre_key_remove(self.physical_local, self.physical_remote, self.asn)

Interface.register(MeshTunnel)


def create(logger, name,
            node_local, node_remote,
            physical_local, physical_remote,
            virtual_local, virtual_remote):
    '''
    Create a mesh tunnel.
    '''

    return MeshTunnel(
        logger, name,
        node_local, node_remote,
        physical_local, physical_remote,
        virtual_local, virtual_remote,
Example #7
0
    def start(self):
        '''
        Starts with the BGP process.
        '''

        return


    def stop(self):
        '''
        Stops with the BGP process.
        '''

        return

Interface.register(BGP)


def read(logger, name, config):
    '''
    Create a static bgp from the given configuration object.
    '''

    neighbor = util.ip_address_get(config["neighbor"])
    local = util.ip_address_get(config["local"]) if "local" in config else None

    local_asn = util.integer_get(config["local-asn"], minval=0, maxval=65535) if "local-asn" in config else None
    neighbor_asn = util.integer_get(config["neighbor-asn"], minval=0, maxval=65535) if "neighbor-asn" in config else None

    bfd = util.boolean_get(config["bfd"]) if "bfd" in config else False
    ttl_security = util.boolean_get(config["ttl-security"]) if "ttl-security" in config else False