Exemple #1
0
    def nodes(self):
        nodes = []
        for n in self.rspec.findall(".//{%s}node" % (self.none)):
            if not self.check_se_node_resource(n):
                logger.info("Skipping this node, not a SE-res: %s", (n,))
                continue

            host_name = None
            host = n.find("{%s}host" % (self.none))
            # For SERM manifest the host tag SHOULD be specified
            if host:
                host_name = host.attrib.get("name")

            node = SENode(n.attrib.get("client_id"),
                          n.attrib.get("component_manager_id"),
                          n.attrib.get("exclusive"),
                          hostname=host_name)

            self.update_protogeni_cm_uuid(n, node)

            for i in n.iterfind("{%s}interface" % (self.none)):
                interface = Interface(i.attrib.get("client_id"))
                # NOTE: sharedvlan namespace not used anymore
#                for sv in i.iterfind("{%s}link_shared_vlan" % (self.__sv)):
#                    interface.add_vlan(sv.attrib.get("vlantag"),
#                                       sv.attrib.get("name"))
                node.add_interface(interface.serialize())

            nodes.append(node.serialize())
        return nodes
Exemple #2
0
    def nodes(self):
        nodes = []
        for n in self.rspec.findall(".//{%s}node" % (self.none)):
            if not self.check_se_node_resource(n):
                logger.info("Skipping this node, not a SE-res: %s", (n, ))
                continue

            host_name = None
            host = n.find("{%s}host" % (self.none))
            # For SERM manifest the host tag SHOULD be specified
            if host:
                host_name = host.attrib.get('name')

            node = SENode(n.attrib.get("client_id"),
                          n.attrib.get("component_manager_id"),
                          n.attrib.get("exclusive"),
                          hostname=host_name)

            self.update_protogeni_cm_uuid(n, node)

            for i in n.iterfind("{%s}interface" % (self.none)):
                interface = Interface(i.attrib.get("client_id"))
                for sv in i.iterfind("{%s}link_shared_vlan" % (self.__sv)):
                    interface.add_vlan(sv.attrib.get("vlantag"),
                                       sv.attrib.get("name"))
                node.add_interface(interface.serialize())

            nodes.append(node.serialize())
        return nodes
    def nodes(self):
        nodes_ = []
        for n in self.rspec.iterchildren("{%s}node" % (self.none)):
            s_ = None
            sliver_type = n.find("{%s}sliver_type" % (self.none))
            if sliver_type is not None:
                s_ = sliver_type.attrib.get("name")

            n_ = Node(n.attrib.get("component_id"), n.attrib.get("component_manager_id"), n.attrib.get("exclusive"), s_)

            self.__update_protogeni_cm_uuid(n, n_)

            for i in n.iterfind("{%s}interface" % (self.none)):
                i_ = Interface(i.attrib.get("component_id"))
                n_.add_interface(i_.serialize())

            nodes_.append(n_.serialize())

        return nodes_
Exemple #4
0
    def get_nodes(self, rspec):
        nodes = []
        for n in rspec.findall(".//{%s}node" % (self.none)):
            if not self.check_se_node_resource(n):
                logger.info("Skipping this node, not a SE-res: %s", (n,))
                continue

            node = Node(n.attrib.get("client_id"), n.attrib.get("component_manager_id"), n.attrib.get("exclusive"))

            self.update_protogeni_cm_uuid(n, node)

            for i in n.iterfind("{%s}interface" % (self.none)):
                interface = Interface(i.attrib.get("client_id"))
                # Note: old format using 'sharedvlan' namespace
                for sv in i.iterfind("{%s}link_shared_vlan" % (self.__sv)):
                    interface.add_vlan(sv.attrib.get("vlantag"), sv.attrib.get("name"))
                node.add_interface(interface.serialize())

            nodes.append(node.serialize())
        return nodes
Exemple #5
0
    def __update_nodes(self, nodes, values):
        for v in values:
            if v.get("node") is not None:
                cid = v.get("node").get("component_id")
                cmid = v.get("node").get("component_manager_id")
                if not self.__is_node_present(nodes, cid, cmid):
                    n = Node(cid, cmid, sliver_type_name=v.get("routing_key"))
                    nodes.append(n)

        for v in values:
            if v.get("node") is not None:
                for n in nodes:
                    scid = v.get("node").get("component_id")
                    scmid = v.get("node").get("component_manager_id")
                    ncid = n.serialize().get("component_id")
                    ncmid = n.serialize().get("component_manager_id")
                    if (scid == ncid) and (scmid == ncmid):
                        for i in v.get("internal_ifs"):
                            intf = Interface(i.get("component_id"))
                            # intf.add_vlan(v.get("vlan"), "")
                            n.add_interface(intf.serialize())
Exemple #6
0
    def nodes(self):
        nodes_ = []
        for n in self.rspec.iterchildren("{%s}node" % (self.none)):
            s_ = None
            sliver_type = n.find("{%s}sliver_type" % (self.none))
            if sliver_type is not None:
                s_ = sliver_type.attrib.get("name")

            n_ = Node(n.attrib.get("component_id"),
                      n.attrib.get("component_manager_id"),
                      n.attrib.get("exclusive"), s_)

            self.__update_protogeni_cm_uuid(n, n_)

            for i in n.iterfind("{%s}interface" % (self.none)):
                i_ = Interface(i.attrib.get("component_id"))
                n_.add_interface(i_.serialize())

            nodes_.append(n_.serialize())

        return nodes_
Exemple #7
0
    def __update_nodes(self, nodes, values):
        for v in values:
            if v.get("node") is not None:
                cid = v.get("node").get("component_id")
                cmid = v.get("node").get("component_manager_id")
                if not self.__is_node_present(nodes, cid, cmid):
                    n = Node(cid, cmid, sliver_type_name=v.get("routing_key"))
                    nodes.append(n)

        for v in values:
            if v.get("node") is not None:
                for n in nodes:
                    scid = v.get("node").get("component_id")
                    scmid = v.get("node").get("component_manager_id")
                    ncid = n.serialize().get("component_id")
                    ncmid = n.serialize().get("component_manager_id")
                    if (scid == ncid) and (scmid == ncmid):
                        for i in v.get("internal_ifs"):
                            intf = Interface(i.get("component_id"))
                            intf.add_vlan(v.get("vlan"), "")
                            n.add_interface(intf.serialize())
Exemple #8
0
    def get_nodes(self, rspec):
        nodes = []
        for n in rspec.findall(".//{%s}node" % (self.none)):
            if not self.check_se_node_resource(n):
                logger.info("Skipping this node, not a SE-res: %s", (n, ))
                continue

            node = Node(n.attrib.get("client_id"),
                        n.attrib.get("component_manager_id"),
                        n.attrib.get("exclusive"))

            self.update_protogeni_cm_uuid(n, node)

            for i in n.iterfind("{%s}interface" % (self.none)):
                interface = Interface(i.attrib.get("client_id"))
                for sv in i.iterfind("{%s}link_shared_vlan" % (self.__sv)):
                    interface.add_vlan(sv.attrib.get("vlantag"),
                                       sv.attrib.get("name"))
                node.add_interface(interface.serialize())

            nodes.append(node.serialize())
        return nodes