blob: 505ac4c6425cf89655f355356f34d93a1b951609 [file] [log] [blame]
Hongjun Ni62f9cdd2017-07-04 20:11:57 +08001
2from vpp_interface import VppInterface
3import socket
Ole Troan8006c6a2018-12-17 12:02:26 +01004from vpp_papi import mac_pton
Hongjun Ni62f9cdd2017-07-04 20:11:57 +08005
6
7class VppPppoeInterface(VppInterface):
8 """
9 VPP Pppoe interface
10 """
11
12 def __init__(self, test, client_ip, client_mac,
13 session_id, decap_vrf_id=0):
14 """ Create VPP PPPoE4 interface """
Klement Sekerab9ef2732018-06-24 22:49:33 +020015 super(VppPppoeInterface, self).__init__(test)
Hongjun Ni62f9cdd2017-07-04 20:11:57 +080016 self.client_ip = client_ip
17 self.client_mac = client_mac
18 self.session_id = session_id
19 self.decap_vrf_id = decap_vrf_id
Stanislav Zaikin938af5e2020-12-03 19:09:53 +000020 self.vpp_sw_if_index = -1
Hongjun Ni62f9cdd2017-07-04 20:11:57 +080021
22 def add_vpp_config(self):
Hongjun Ni62f9cdd2017-07-04 20:11:57 +080023 r = self.test.vapi.pppoe_add_del_session(
Ole Troan04338e82019-12-06 14:23:10 +010024 self.client_ip, self.client_mac,
Hongjun Ni62f9cdd2017-07-04 20:11:57 +080025 session_id=self.session_id,
26 decap_vrf_id=self.decap_vrf_id)
Klement Sekerab9ef2732018-06-24 22:49:33 +020027 self.set_sw_if_index(r.sw_if_index)
Stanislav Zaikin938af5e2020-12-03 19:09:53 +000028 self.vpp_sw_if_index = r.sw_if_index
Hongjun Ni62f9cdd2017-07-04 20:11:57 +080029 self.generate_remote_hosts()
30
31 def remove_vpp_config(self):
Hongjun Ni62f9cdd2017-07-04 20:11:57 +080032 self.unconfig()
Klement Sekerab9ef2732018-06-24 22:49:33 +020033 self.test.vapi.pppoe_add_del_session(
Ole Troan04338e82019-12-06 14:23:10 +010034 self.client_ip, self.client_mac,
Hongjun Ni62f9cdd2017-07-04 20:11:57 +080035 session_id=self.session_id,
36 decap_vrf_id=self.decap_vrf_id,
37 is_add=0)
Stanislav Zaikin938af5e2020-12-03 19:09:53 +000038
39 def set_unnumbered(self, swif_iface):
40 self.test.vapi.sw_interface_set_unnumbered(
41 swif_iface,
42 self.vpp_sw_if_index)