L2TPSessionDevice

class lnst.Devices.L2TPSessionDevice.L2TPSessionDevice(ifmanager, *args, **kwargs)

Bases: Device

This device class allows user to create L2TP sessions for tunnels previously created using the L2TPManager.

from lnst.Controller import BaseRecipe
from lnst.Controller.Requirements import HostReq
from lnst.RecipeCommon.L2TPManager import L2TPManager
from lnst.Devices import L2TPSessionDevice

class L2TPRecipe(BaseRecipe):
    m1 = HostReq()

    def test(self):
        m1 = self.matched.m1
        m1.l2tp = m1.init_class(L2TPManager)
        m1.l2tp.create_tunnel(
                tunnel_id=1000,
                peer_tunnel_id=1000,
                encap="udp",
                local="192.168.200.1",
                remote="192.168.200.2",
                udp_sport=5000,
                udp_dport=5000

        m1.session1 = L2TPSessionDevice(
                tunnel_id=1000,
                session_id=2000,
                peer_session_id=2000
        )
        m1.session1.up()
_mandatory_opts = ['tunnel_id', 'session_id', 'peer_session_id']

mandatory options for the device