Example #1
0
    def get_network_list(self, account):
        """
        Returns the discovered network

        @param account - a SDN account

        """
        topology_source = "/net/boson/home1/rchamart/work/topology/l2_top.xml"
        logger.info("Reading topology file: %s", topology_source)
        tree = etree.parse(topology_source)
        root = tree.getroot()
        xmlstr = etree.tostring(root, encoding="unicode")

        model = RwYang.Model.create_libncx()
        model.load_schema_ypbc(RwTl.get_schema())
        nwtop = RwTl.YangData_IetfNetwork()
        # The top level topology object does not have XML conversion
        # Hence going one level down
        l2nw1 = nwtop.network.add()
        l2nw1.from_xml_v2(model, xmlstr)

        logger.debug("Returning topology data imported from XML file")

        return nwtop
                        for lbuf in buffer:
                            outf.write(lbuf)
                        buffer = []  # empty buffer
                        print("\n\n")
                    continue

                if in_block:
                    print("Gathering line...", line)
                    buffer.append(line)  # gather lines
                else:
                    outf.write(line)


if __name__ == "__main__":
    model = RwYang.Model.create_libyang()
    model.load_schema_ypbc(RwTl.get_schema())
    # create logger
    logger = logging.getLogger('Provider Network Topology')
    logger.setLevel(logging.DEBUG)
    logging.basicConfig(level=logging.DEBUG)

    logger.info('Creating an instance of Provider Network Topology')

    nwtop = RwTl.YangData_IetfNetwork()

    # Setup L2 topology
    l2top = MyL2Topology(nwtop, logger)
    l2top.setup_all()

    # Setup Provider network topology
    provtop = MyProvTopology(nwtop, l2top, logger)
Example #3
0
 def __init__(self):
     super(SdnSim, self).__init__()
     self._model = RwYang.Model.create_libncx()
     self._model.load_schema_ypbc(RwTl.get_schema())
Example #4
0
 def configure_schema(cls):
     return RwTl.get_schema()
        # Add links to sfcnet1 network
        # These links are unidirectional and point-to-point
        logging.debug("Setting up links")
        # Bidir Links for OVS bridges
        self.create_link(self.sfc1, self.sfc1_vxlannsh1, self.sff1, self.sff1_vxlannsh1, "Link_sfc1_sff1")
        self.create_link(self.sfc1, self.sfc1_vxlannsh1, self.sf1, self.sf1_vxlannsh1, "Link_sff1_sf1", "Link_sf1_sff1")

    def setup_all(self):
        self.setup_nodes()
        self.setup_tps()
        #self.setup_links()


if __name__ == "__main__":
    model = RwYang.Model.create_libncx()
    model.load_schema_ypbc(RwTl.get_schema())
    # create logger 
    logger = logging.getLogger('SFC Network Topology')
    logger.setLevel(logging.DEBUG)
    logging.basicConfig(level=logging.DEBUG)

    logger.info('Creating an instance of SFC Network Topology')

    nwtop = RwTl.YangData_IetfNetwork()

    # Setup L2 topology
    l2top = MyL2Topology(nwtop, logger)
    l2top.setup_all()

    # Setup Provider network topology
    provtop = MyProvTopology(nwtop, l2top, logger)
Example #6
0
 def configure_schema(cls):
     return RwTl.get_schema()