def build(platform_id, children):
            """
            Returns the root NNode for the given platform_id with its
            children according to the given list.
            """
            nnode = NNode(platform_id)
            if self._agent_device_map:
                self._set_attributes_and_ports_from_agent_device_map(nnode)

            log.debug('Created NNode for %r', platform_id)

            for subplatform_id in children:
                subplatform_children = self._topology.get(subplatform_id, [])
                sub_nnode = build(subplatform_id, subplatform_children)
                nnode.add_subplatform(sub_nnode)

            return nnode
        def build_network_definition(map):
            """
            Returns the root NNode according to self._platform_id and the OMS'
            getPlatformMap response.
            """
            nodes = NNode.create_network(map)
            if not self._platform_id in nodes:
                msg = "platform map does not contain entry for %r" % self._platform_id
                log.error(msg)
                raise PlatformException(msg=msg)

            return nodes[self._platform_id]
Beispiel #3
0
        except Exception, e:
            print "error generating diagrams: %s" % str(e)

    uri = os.getenv("OMS", "http://*****:*****@10.180.80.10:9021/")

    #####
    import re

    if re.search("simulator", uri):
        from ion.agents.platform.oms.oms_client_factory import OmsClientFactory

        oms = OmsClientFactory.create_instance(uri)
        print "ping() = %s" % oms.ping()
        map = oms.getPlatformMap()
        print "getPlatformMap() = %s" % map
        nodes = NNode.create_network(map)
        if not "" in nodes:
            print "platform map does not include '' to indicate root platforms."
        else:
            dummy_root = nodes[""]
            gen_diagrams("sim_topology", dummy_root)
        sys.exit()
    #####

    proxy = xmlrpclib.ServerProxy(uri)

    retval = proxy.hello.ping()
    print "ping() = %s" % retval

    retval = proxy.config.getPlatformMap()
    print "getPlatformMap() = %s" % retval