Skip to content

XIR updates

Brian Kocoloski requested to merge bjk-dev into main
  1. Miscellaneous builder updates for better facility modeling
  2. Add MX support for specifying capacity, queues, and model of the ports that connect nodes in a user model.

With the MX update comes a new MX helper function for connections when you care about the constraints on the port. This is called connect_sockets as opposed to connect. See the following example:

from mergexp import *

net = Network('test')

n0 = net.node('n0')
n1 = net.node('n1')

# port.queues, port.model, and port.capacity
port0 = n0.socket(port.queues == 4, port.model == e1000)
port1 = n1.socket(port.queues == 4, port.model == e1000)

# this accepts the same link emulation parameters as net.connect(): capacity, loss, delay
net.connect_sockets([port0, port1])

When you simply call net.connect() instead of net.connect_sockets(), the sockets are allocated for you. This new function simply lets you allocate them yourself

Edited by Brian Kocoloski

Merge request reports