def testCreateNetXmlBridged(self): expectedDoc = """<network> <name>vdsm-awesome_net</name> <forward mode='bridge'/> <bridge name='awesome_net'/> </network>""" actualDoc = libvirtCfg.createNetworkDef('awesome_net', bridged=True) self.assertEqualXml(expectedDoc, actualDoc)
def testCreateNetXml(self): iface = "dummy" expectedDoc = ("""<network> <name>vdsm-awesome_net</name> <forward mode='passthrough'/> <interface dev='%s'/> </network>""" % iface) actualDoc = libvirtCfg.createNetworkDef('awesome_net', bridged=False, iface=iface) self.assertEqualXml(expectedDoc, actualDoc)
def testCreateNetXml(self): iface = "dummy" expectedDoc = ("""<network> <name>vdsm-awesome_net</name> <forward mode='passthrough'> <interface dev='%s'/> </forward> </network>""" % iface) actualDoc = libvirtCfg.createNetworkDef('awesome_net', bridged=False, iface=iface) self.assertEqualXml(expectedDoc, actualDoc)
def testCreateNetXmlBridgedQos(self): inbound = {'average': '1024', 'burst': '5000'} outbound = {'average': '666', 'burst': '666', 'peak': '400'} expectedDoc = ( """<network> <name>vdsm-awesome_net</name> <forward mode='bridge'/> <bridge name='awesome_net'/> <bandwidth> <inbound average='%s' burst='%s' /> <outbound average='%s' burst='%s' peak='%s' /> </bandwidth> </network>""" % (inbound['average'], inbound['burst'], outbound['average'], outbound['burst'], outbound['peak'])) actualDoc = libvirtCfg.createNetworkDef('awesome_net', qosInbound=inbound, qosOutbound=outbound) self.assertEqualXml(expectedDoc, actualDoc)
def testCreateNetXmlBridgedQos(self): inbound = {'average': '1024', 'burst': '5000'} outbound = {'average': '666', 'burst': '666', 'peak': '400'} expectedDoc = ("""<network> <name>vdsm-awesome_net</name> <forward mode='bridge'/> <bridge name='awesome_net'/> <bandwidth> <inbound average='%s' burst='%s' /> <outbound average='%s' burst='%s' peak='%s' /> </bandwidth> </network>""" % (inbound['average'], inbound['burst'], outbound['average'], outbound['burst'], outbound['peak'])) actualDoc = libvirtCfg.createNetworkDef('awesome_net', qosInbound=inbound, qosOutbound=outbound) self.assertEqualXml(expectedDoc, actualDoc)