nsg-ethz / p4-utils

Extension to Mininet that makes P4 networks easier to build
GNU General Public License v2.0
187 stars 68 forks source link

Does P4Utils Support IPv6 ? #66

Open liudsl opened 1 year ago

liudsl commented 1 year ago

Hi everyone:

I want to do something about SRv6, specifically using BMV2 to implement SRv6, but I found that the function net.setIntfIp() cannot set the IPv6 address for host. How should I solve it?

Thank you very much!

here is my code:

#! /usr/bin/python3

net = NetworkAPI()

# Network general options
net.setLogLevel('info')
net.enableCli()

# Network definition
net.addSwitch("s1")
net.addHost('h1')
net.addHost('h2')

net.addLink('h1', 's1', port2=1)
net.addLink('s1', 'h2', port1=2)

net.setIntfIp("h1", "s1", "2001:db00::0/24")
# Assignment strategy
# net.l2()

# Nodes general options
net.enableLogAll()

# Start the network
net.startNetwork()

And Here is the output after sudo python3 network:

.......
Topology saved to disk!
Programming switches...
Switches programmed correctly!
Programming hosts...

Traceback (most recent call last):
  File "network.py", line 39, in <module>
    net.startNetwork()
  File "/home/ubuntu/p4-tools/p4-utils/p4utils/mininetlib/network_API.py", line 1135, in startNetwork
    self.program_hosts()
  File "/home/ubuntu/p4-tools/p4-utils/p4utils/mininetlib/network_API.py", line 341, in program_hosts
    '{}/{}'.format(intf1.ip, intf1.prefixLen))
  File "/usr/lib/python3.6/ipaddress.py", line 119, in ip_interface
    address)
ValueError: 'None/24' does not appear to be an IPv4 or IPv6 interface
edgar-costa commented 11 months ago

@liudsl Unfortunately, for most features we do not have support for IPv6.

To solve it you would need to adapt the code in all the placers where we assume addresses are IPv4.

edgar-costa commented 11 months ago

@huyongqingandczw Why do you write your question in this git issue thread, I don't think what you are asking has anything to do with the original question. Can you please not do that?

If your question is unrelated to the current thread, I kindly suggest creating a new issue or finding a thread that aligns more closely with your topic.

jose-galvao commented 4 months ago

Hello @liudsl what did you do to solve that?