예제 #1
0
    def manage_allocate(self, surn, creds, end, sdn_info, tn_info):
        route = {}
        self.__update_info_route(route, sdn_info, "dpids")
        logger.debug("SE-SdnInfo(%d)=%s" % (len(sdn_info), sdn_info,))
        self.__update_info_route(route, tn_info, "interface")
        logger.debug("SE-TnInfo(%d)=%s" % (len(tn_info), tn_info,))

        self.__update_route_rspec(route, sdn_info, tn_info)
        logger.info("Route=%s" % (route,))

        manifests, slivers, db_slivers = [], [], []

        for k, v in route.iteritems():
            try:
                (m, ss) =\
                    self.send_request_allocate_rspec(k, v, surn, creds, end)
                manifest = SERMv3ManifestParser(from_string=m)
                logger.debug("SERMv3ManifestParser=%s" % (manifest,))
                self.validate_rspec(manifest.get_rspec())

                nodes = manifest.nodes()
                logger.info("Nodes(%d)=%s" % (len(nodes), nodes,))
                links = manifest.links()
                logger.info("Links(%d)=%s" % (len(links), links,))

                manifests.append({"nodes": nodes, "links": links})

                self.extend_slivers(ss, k, slivers, db_slivers)
            except Exception as e:
                logger.critical("manage_allocate exception: %s", e)
                raise delegate_ex.AllocationError(
                    str(e), surn, slivers, db_slivers)

        return (manifests, slivers, db_slivers)
예제 #2
0
    def manage_allocate(self, slice_urn, credentials, slice_expiration,
                        slivers, parser):
        route = {}
        self.__update_route(route, slivers)
        logger.debug("Slivers=%s" % (slivers, ))

        self.__update_route_rspec(route, slivers)
        logger.info("Route=%s" % (route, ))
        manifests, slivers, db_slivers = [], [], []

        for k, v in route.iteritems():
            try:
                (m, ss) = self.send_request_allocate_rspec(
                    k, v, slice_urn, credentials, slice_expiration)
                manifest = CRMv3ManifestParser(from_string=m)
                logger.debug("CRMv3ManifestParser=%s" % (manifest, ))

                nodes = manifest.nodes()
                logger.info("Nodes(%d)=%s" % (
                    len(nodes),
                    nodes,
                ))
                manifests.append({"nodes": nodes})

                self.extend_slivers(ss, k, slivers, db_slivers)
            except Exception as e:
                logger.critical("manage_allocate exception: %s", e)
                raise delegate_ex.AllocationError(str(e), slice_urn, slivers,
                                                  db_slivers)

        return (manifests, slivers, db_slivers)
예제 #3
0
    def manage_allocate(self, surn, creds, end, sliver, parser, slice_urn,
                        extended_group_info):
        route = {}
        controllers = parser.of_controllers()
        logger.debug("Controllers=%s" % (controllers, ))

        groups = parser.of_groups()
        matches = parser.of_matches()

        groups_matches = parser.of_groups_matches()

        # Rename group/matches names if duplicated
        (groups, matches) = self.__rename_groups_matches(groups_matches)

        # Update the group info to support the mapper module
        for eg in extended_group_info:
            for g in groups:
                self.__update_group_with_extended_info(eg, g)

        self.__update_route(route, groups)
        logger.debug("Groups=%s" % (groups, ))

        self.__update_route(route, matches)
        logger.debug("Matches=%s" % (matches, ))

        se_sdn_info = self.__extract_se_from_sdn(groups, matches)
        logger.debug("SE-SDN-INFO=%s" % (se_sdn_info, ))

        self.__update_route_rspec(route, sliver, controllers, groups, matches)
        logger.info("Route=%s" % (route, ))
        manifests, slivers, db_slivers = [], [], []

        for k, v in route.iteritems():
            try:
                (m, ss) =\
                    self.send_request_allocate_rspec(k, v, surn, creds, end)
                manifest = OFv3ManifestParser(from_string=m)
                logger.debug("OFv3ManifestParser=%s" % (manifest, ))

                slivers_ = manifest.slivers()
                logger.info("Slivers(%d)=%s" % (
                    len(slivers_),
                    slivers_,
                ))
                manifests.append({"slivers": slivers_})

                self.extend_slivers(ss, k, slivers, db_slivers)
            except Exception as e:
                logger.critical("manage_sdn_allocate exception: %s", e)
                raise delegate_ex.AllocationError(str(e), slice_urn, slivers,
                                                  db_slivers)

        # insert sliver details (groups and matches) into the slice.sdn table
        id_ = db_sync_manager.store_slice_sdn(slice_urn, groups, matches)
        logger.info("Stored slice.sdn info: id=%s" % (id_, ))
        return (manifests, slivers, db_slivers, se_sdn_info)
예제 #4
0
파일: tn.py 프로젝트: dana-i2cat/felix
    def manage_allocate(self, surn, creds, end, nodes_in, links_in):
        route = {}
        nodes = self.__update_node_route(route, nodes_in)
        logger.debug("Nodes(%d)=%s" % (
            len(nodes),
            nodes,
        ))
        links = self.__update_link_route(route, links_in)
        logger.debug("Links(%d)=%s" % (
            len(links),
            links,
        ))

        if self.__workaround_split_allocation:
            # This is a (very)ugly workaround that we MUST remove ASAP!!!
            return self.__manage_allocate_split_workaround(
                surn, creds, end, nodes, links)

        self.__update_route_rspec(route, nodes, links)
        logger.info("Route=%s" % (route, ))

        manifests, slivers, db_slivers, se_tn_info = [], [], [], []

        for k, v in route.iteritems():
            try:
                (m, ss) =\
                    self.send_request_allocate_rspec(k, v, surn, creds, end)
                manifest = TNRMv3ManifestParser(from_string=m)
                logger.debug("TNRMv3ManifestParser=%s" % (manifest, ))
                self.validate_rspec(manifest.get_rspec())

                nodes = manifest.nodes()
                logger.info("Nodes(%d)=%s" % (
                    len(nodes),
                    nodes,
                ))
                links = manifest.links()
                logger.info("Links(%d)=%s" % (
                    len(links),
                    links,
                ))

                manifests.append({"nodes": nodes, "links": links})

                self.extend_slivers(ss, k, slivers, db_slivers)

                se_tn = self.__extract_se_from_tn(nodes, links)
                logger.debug("SE-TN-INFO=%s" % (se_tn, ))
                if len(se_tn) > 0:
                    se_tn_info.extend(se_tn)
            except Exception as e:
                logger.critical("manage_allocate exception: %s", e)
                raise delegate_ex.AllocationError(str(e), surn, slivers,
                                                  db_slivers)

        return (manifests, slivers, db_slivers, se_tn_info)
예제 #5
0
    def manage_direct_allocate(self, surn, creds, end, nodes, links):
        route = {}
        self.__update_node_route(route, nodes)
        logger.debug("Nodes(%d)=%s" % (
            len(nodes),
            nodes,
        ))
        self.__update_link_route(route, links)
        logger.debug("Links(%d)=%s" % (
            len(links),
            links,
        ))

        # XXX_FIXME_XXX: the SERM requires a new field in the link attribute
        # (felix:vlan). This is not compatible with the GENI world...
        self.__update_link_with_vlantag(nodes, links)
        logger.warning("Updated Links(%d)=%s" % (
            len(links),
            links,
        ))

        self.__update_direct_route_rspec(route, nodes, links)
        logger.info("Route=%s" % (route, ))

        manifests, slivers, db_slivers = [], [], []

        for k, v in route.iteritems():
            try:
                (m, ss) =\
                    self.send_request_allocate_rspec(k, v, surn, creds, end)
                manifest = SERMv3ManifestParser(from_string=m)
                logger.debug("SERMv3ManifestParser=%s" % (manifest, ))
                self.validate_rspec(manifest.get_rspec())

                nodes = manifest.nodes()
                logger.info("Nodes(%d)=%s" % (
                    len(nodes),
                    nodes,
                ))
                links = manifest.links()
                logger.info("Links(%d)=%s" % (
                    len(links),
                    links,
                ))

                manifests.append({"nodes": nodes, "links": links})

                self.extend_slivers(ss, k, slivers, db_slivers)
            except Exception as e:
                logger.critical("manage_direct_allocate exception: %s", e)
                raise delegate_ex.AllocationError(str(e), surn, slivers,
                                                  db_slivers)

        return (manifests, slivers, db_slivers)