Пример #1
0
    def manage_provision(self, peer, urns, creds, beffort, etime, gusers):
        try:
            adaptor, uri = AdaptorFactory.create_from_db(peer)
            logger.debug("Adaptor=%s, uri=%s" % (adaptor, uri))
            m, urn = adaptor.provision(urns, creds[0]["geni_value"], beffort,
                                       etime, gusers)

            manifest = OFv3ManifestParser(from_string=m)
            logger.debug("OFv3ManifestParser=%s" % (manifest, ))
            self.validate_rspec(manifest.get_rspec())

            slivers = manifest.slivers()
            logger.info("Slivers(%d)=%s" % (
                len(slivers),
                slivers,
            ))

            return ({"slivers": slivers}, urn)
        except Exception as e:
            # It is possible that SDNRM does not implement this method!
            if beffort:
                logger.error("manage_provision exception: %s", e)
                return ({"slivers": []}, [])
            else:
                logger.critical("manage_provision exception: %s", e)
                raise e
Пример #2
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)
Пример #3
0
def main(argv=None):
    if not argv:
        argv = sys.argv

    print 'Start the test environment'
    print '=== OFv3AdvertisementParser ==='
    rspec = OFv3AdvertisementParser("adv_rspec_example.xml")
    in_validate(rspec.get_rspec())

    print '=== OFv3RequestParser ==='
    rspec = OFv3RequestParser("request_rspec_example.xml")
    in_validate(rspec.get_rspec())

    print '=== OFv3ManifestParser ==='
    rspec = OFv3ManifestParser("manifest_rspec_example.xml")
    in_validate(rspec.get_rspec())

    print 'Bye Bye...'
    return True
Пример #4
0
    def manage_describe(self, peer, urns, creds):
        try:
            adaptor, uri = AdaptorFactory.create_from_db(peer)
            logger.debug("Adaptor=%s, uri=%s" % (adaptor, uri))
            m, urn, ss = adaptor.describe(urns, creds[0]["geni_value"])

            manifest = OFv3ManifestParser(from_string=m)
            logger.debug("OFv3ManifestParser=%s" % (manifest, ))
            self.validate_rspec(manifest.get_rspec())

            slivers = manifest.slivers()
            logger.info("Slivers(%d)=%s" % (
                len(slivers),
                slivers,
            ))

            return ({"slivers": slivers}, urn, ss)
        except Exception as e:
            logger.critical("manage_describe exception: %s", e)
            raise e
Пример #5
0
 def __init__(self, from_file=None, from_string=None):
     super(ROManifestParser, self).__init__(from_file, from_string)
     self.__com_parser = CRMv3ManifestParser(from_file, from_string)
     self.__of_parser = OFv3ManifestParser(from_file, from_string)
     self.__se_parser = SERMv3ManifestParser(from_file, from_string)
     self.__tn_parser = TNRMv3ManifestParser(from_file, from_string)