2017-07-04 20:11:57 +08:00
|
|
|
from vpp_interface import VppInterface
|
|
|
|
import socket
|
2018-12-17 12:02:26 +01:00
|
|
|
from vpp_papi import mac_pton
|
2017-07-04 20:11:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
class VppPppoeInterface(VppInterface):
|
|
|
|
"""
|
|
|
|
VPP Pppoe interface
|
|
|
|
"""
|
|
|
|
|
2022-04-26 19:02:15 +02:00
|
|
|
def __init__(self, test, client_ip, client_mac, session_id, decap_vrf_id=0):
|
|
|
|
"""Create VPP PPPoE4 interface"""
|
2018-06-24 22:49:33 +02:00
|
|
|
super(VppPppoeInterface, self).__init__(test)
|
2017-07-04 20:11:57 +08:00
|
|
|
self.client_ip = client_ip
|
|
|
|
self.client_mac = client_mac
|
|
|
|
self.session_id = session_id
|
|
|
|
self.decap_vrf_id = decap_vrf_id
|
2020-12-03 19:09:53 +00:00
|
|
|
self.vpp_sw_if_index = -1
|
2017-07-04 20:11:57 +08:00
|
|
|
|
|
|
|
def add_vpp_config(self):
|
|
|
|
r = self.test.vapi.pppoe_add_del_session(
|
2022-04-26 19:02:15 +02:00
|
|
|
self.client_ip,
|
|
|
|
self.client_mac,
|
|
|
|
session_id=self.session_id,
|
|
|
|
decap_vrf_id=self.decap_vrf_id,
|
|
|
|
)
|
2018-06-24 22:49:33 +02:00
|
|
|
self.set_sw_if_index(r.sw_if_index)
|
2020-12-03 19:09:53 +00:00
|
|
|
self.vpp_sw_if_index = r.sw_if_index
|
2017-07-04 20:11:57 +08:00
|
|
|
self.generate_remote_hosts()
|
|
|
|
|
|
|
|
def remove_vpp_config(self):
|
|
|
|
self.unconfig()
|
2018-06-24 22:49:33 +02:00
|
|
|
self.test.vapi.pppoe_add_del_session(
|
2022-04-26 19:02:15 +02:00
|
|
|
self.client_ip,
|
|
|
|
self.client_mac,
|
|
|
|
session_id=self.session_id,
|
|
|
|
decap_vrf_id=self.decap_vrf_id,
|
|
|
|
is_add=0,
|
|
|
|
)
|
2020-12-03 19:09:53 +00:00
|
|
|
|
|
|
|
def set_unnumbered(self, swif_iface):
|
2022-04-26 19:02:15 +02:00
|
|
|
self.test.vapi.sw_interface_set_unnumbered(swif_iface, self.vpp_sw_if_index)
|