示例#1
0
    def __init__(self, connection, transparent):
        log.info("Init...")
        self.connection = connection
        self.transparent = transparent
        connection.addListeners(self)

        self.flowcreator = FlowCreator()

        self.createFlowRules()
示例#2
0
class Controller(object):
    def __init__(self, connection, transparent):
        log.info("Init...")
        self.connection = connection
        self.transparent = transparent
        connection.addListeners(self)

        self.flowcreator = FlowCreator()

        self.createFlowRules()

    def _handle_PacketIn(self, event):
        packet = event.parsed
        log.info("Packet from " + str(packet.src) + " to " + str(packet.dst))

    def createFlowRules(self):
        viewreader = ViewReader()
        #viewfile = str(raw_input("Enter the path to your view file (e.g. /home/mininet/nv.nv):"))
        with open("/home/mininet/config.conf") as file:
            lines = file.readlines()
        print("Loaded path from config file " + lines[0])
        viewfile = lines[0].replace("\n", "")
        nv = viewreader.readNetworkView(viewfile)
        rules = self.flowcreator.generateRules(nv)
        for r in rules:
            self.connection.send(r)
示例#3
0
class Controller(object):

  def __init__ (self,connection,transparent):
    log.info("Init...")
    self.connection = connection
    self.transparent = transparent
    connection.addListeners(self)

    self.flowcreator = FlowCreator()

    self.createFlowRules()

  def _handle_PacketIn (self, event):
    packet = event.parsed
    log.info("Packet from " + str(packet.src) + " to " + str(packet.dst))

  def createFlowRules(self):
    viewreader = ViewReader()
    #viewfile = str(raw_input("Enter the path to your view file (e.g. /home/mininet/nv.nv):"))
    with open("/home/mininet/config.conf") as file:
        lines = file.readlines()
    print("Loaded path from config file " + lines[0])
    viewfile = lines[0].replace("\n", "")
    nv = viewreader.readNetworkView(viewfile)
    rules = self.flowcreator.generateRules(nv)
    for r in rules:
      self.connection.send(r)
示例#4
0
  def __init__ (self,connection,transparent):
    log.info("Init...")
    self.connection = connection
    self.transparent = transparent
    connection.addListeners(self)

    self.flowcreator = FlowCreator()

    self.createFlowRules()