Skip to content
  • Leigh B Stoller's avatar
    A tiny little tweak that allows you to set the IPs on layer 1 link · 728bd3bd
    Leigh B Stoller authored
    ifaces that correspond to endpoints on nodes. Makes it easier to
    do something like this, if we init the interfaces on the nodes with IP
    and mask and bring it up.
    
    	# Add a raw PC to the request and give it an interface.
    	node1 = request.RawPC("node1")
    	iface1 = node1.addInterface()
    
    	# Specify the IPv4 address
    	iface1.addAddress(pg.IPv4Address("192.168.1.1", "255.255.255.0"))
    
    	# Add another raw PC to the request and give it an interface.
    	node2 = request.RawPC("node2")
    	iface2 = node2.addInterface()
    
    	# Specify the IPv4 address
    	iface2.addAddress(pg.IPv4Address("192.168.1.2", "255.255.255.0"))
    
    	# Add L1 link from node1 to node2
    	link1 = request.L1Link("link1")
    	link1.addInterface(iface1)
    	link1.addInterface(iface2)
    728bd3bd