Пример #1
0
 def test_report_arrived(self):
     node_oid = str(uuid.uuid1())
     on_report(NodeOnlineReport.create(node_oid, hostname='testhost'))
     on_report(IFConfigReport.create(node_oid, raw_data=IFCONFIG_DATA))
     on_report(BrctlShowReport.create(node_oid, raw_data=BRCTL_SHOW_DATA))
     cluster = Cluster.instance()
     node = cluster.get(node_oid)
     self.assertTrue(node)
     eth2 = node.get_host_nic('eth2')
     self.assertTrue(eth2)
     self.assertEqual(eth2.in_bridge, 'virbr2')
     virbr2 = node.get_host_nic('virbr2')
     self.assertEqual(virbr2.bridge_for,
                      ['eth2', 'vnet0', 'vnet1'])
Пример #2
0
def load_fixtures(node_oid):
    "Load demo data for development"
    from swarm.scenarios import on_report
    from swarm.tests import fixtures
    from swarm.reports import (NodeOnlineReport, VmXMLReport, IFConfigReport,
                               BrctlShowReport, DFReport)
    log.debug('Loading test data')
    storage_oid = str(uuid.uuid4())
    on_report(NodeOnlineReport.create(node_oid,
                                      hostname='testhost',
                                      storages = [dict(
                    storage_oid=storage_oid, path='/home/vgdcloud/storage1')]))
                    
    on_report(IFConfigReport.create(node_oid,
                                    raw_data=fixtures.IFCONFIG_DATA))
    on_report(BrctlShowReport.create(node_oid,
                                     raw_data=fixtures.BRCTL_SHOW_DATA))
    on_report(VmXMLReport.create(node_oid, raw_data=fixtures.LIBVIRT_XML))
    on_report(DFReport.create(node_oid, raw_data=fixtures.DF_RAW))