from vpp_neighbor import VppNeighbor
from vpp_ip_route import find_route, VppIpTable
from util import mk_ll_addr
-
from scapy.layers.l2 import Ether, getmacbyip, ARP
from scapy.layers.inet import IP, UDP, ICMP
from scapy.layers.inet6 import IPv6, in6_getnsmac
from socket import AF_INET, AF_INET6
from scapy.utils import inet_pton, inet_ntop
from scapy.utils6 import in6_ptop
-from util import mactobinary
+from vpp_papi import mac_pton
DHCP4_CLIENT_PORT = 68
DHCP4_SERVER_PORT = 67
UDP(sport=DHCP4_SERVER_PORT, dport=DHCP4_CLIENT_PORT) /
BOOTP(op=1,
yiaddr=self.pg3.local_ip4,
- chaddr=mactobinary(self.pg3.local_mac)) /
+ chaddr=mac_pton(self.pg3.local_mac)) /
DHCP(options=[('message-type', 'offer'),
('server_id', self.pg3.remote_ip4),
'end']))
IP(src=self.pg3.remote_ip4, dst="255.255.255.255") /
UDP(sport=DHCP4_SERVER_PORT, dport=DHCP4_CLIENT_PORT) /
BOOTP(op=1, yiaddr=self.pg3.local_ip4,
- chaddr=mactobinary(self.pg3.local_mac)) /
+ chaddr=mac_pton(self.pg3.local_mac)) /
DHCP(options=[('message-type', 'ack'),
('subnet_mask', "255.255.255.0"),
('router', self.pg3.remote_ip4),
# remove the left over ARP entry
self.vapi.ip_neighbor_add_del(self.pg3.sw_if_index,
- mactobinary(self.pg3.remote_mac),
+ mac_pton(self.pg3.remote_mac),
self.pg3.remote_ip4,
is_add=0)
#
IP(src=self.pg3.remote_ip4, dst=self.pg3.local_ip4) /
UDP(sport=DHCP4_SERVER_PORT, dport=DHCP4_CLIENT_PORT) /
BOOTP(op=1, yiaddr=self.pg3.local_ip4,
- chaddr=mactobinary(self.pg3.local_mac)) /
+ chaddr=mac_pton(self.pg3.local_mac)) /
DHCP(options=[('message-type', 'ack'),
('subnet_mask', "255.255.255.0"),
('router', self.pg3.remote_ip4),
IP(src=self.pg3.remote_ip4, dst=self.pg3.local_ip4) /
UDP(sport=DHCP4_SERVER_PORT, dport=DHCP4_CLIENT_PORT) /
BOOTP(op=1, yiaddr=self.pg3.local_ip4,
- chaddr=mactobinary(self.pg3.local_mac)) /
+ chaddr=mac_pton(self.pg3.local_mac)) /
DHCP(options=[('message-type', 'offer'),
('server_id', self.pg3.remote_ip4),
'end']))
IP(src=self.pg3.remote_ip4, dst=self.pg3.local_ip4) /
UDP(sport=DHCP4_SERVER_PORT, dport=DHCP4_CLIENT_PORT) /
BOOTP(op=1, yiaddr=self.pg3.local_ip4,
- chaddr=mactobinary(self.pg3.local_mac)) /
+ chaddr=mac_pton(self.pg3.local_mac)) /
DHCP(options=[('message-type', 'ack'),
('subnet_mask', "255.255.255.0"),
('router', self.pg3.remote_ip4),
# remove the left over ARP entry
self.vapi.ip_neighbor_add_del(self.pg3.sw_if_index,
- mactobinary(self.pg3.remote_mac),
+ mac_pton(self.pg3.remote_mac),
self.pg3.remote_ip4,
is_add=0)
UDP(sport=DHCP4_SERVER_PORT, dport=DHCP4_CLIENT_PORT) /
BOOTP(op=1,
yiaddr=self.pg3.local_ip4,
- chaddr=mactobinary(self.pg3.local_mac)) /
+ chaddr=mac_pton(self.pg3.local_mac)) /
DHCP(options=[('message-type', 'offer'),
('server_id', self.pg3.remote_ip4),
('lease_time', lease_time),
IP(src=self.pg3.remote_ip4, dst='255.255.255.255') /
UDP(sport=DHCP4_SERVER_PORT, dport=DHCP4_CLIENT_PORT) /
BOOTP(op=1, yiaddr=self.pg3.local_ip4,
- chaddr=mactobinary(self.pg3.local_mac)) /
+ chaddr=mac_pton(self.pg3.local_mac)) /
DHCP(options=[('message-type', 'ack'),
('subnet_mask', '255.255.255.0'),
('router', self.pg3.remote_ip4),
# remove the left over ARP entry
self.vapi.ip_neighbor_add_del(self.pg3.sw_if_index,
- mactobinary(self.pg3.remote_mac),
+ mac_pton(self.pg3.remote_mac),
self.pg3.remote_ip4,
is_add=0)