Exemplo n.º 1
0
  def __init__ (self, *args, **kw):
    SoftwareSwitch.__init__(self, *args, **kw)
    self.role_by_conn={}
    self.connections = []
    self.connection_in_action = None
    # index of the next 'other' controller to get a message
    # (for round robin of async messages)
    self.next_other = 0

    # Set of connections to which we have sent hellos.  This is used to
    # as part of overriding the single-connection logic in the superclass.
    self._sent_hellos = set()
Exemplo n.º 2
0
  def __init__ (self, *args, **kw):
    SoftwareSwitch.__init__(self, *args, **kw)
    self.role_by_conn={}
    self.connections = []
    self.connection_in_action = None
    # index of the next 'other' controller to get a message
    # (for round robin of async messages)
    self.next_other = 0

    # Set of connections to which we have sent hellos.  This is used to
    # as part of overriding the single-connection logic in the superclass.
    self._sent_hellos = set()
Exemplo n.º 3
0
  def rx_message (self, connection, msg):
    """
    Handles incoming messages
    
    @overrides SoftwareSwitch.rx_message
    """

    self.connection_in_action = connection
    if not self.check_rights(msg, connection):
      self.log.warn("Message %s not allowed for slave controller %d", msg,
                    connection.ID)
      self.send_vendor_error(connection)
    else:
      SoftwareSwitch.rx_message(self, connection, msg)

    self.connection_in_action = None
Exemplo n.º 4
0
  def rx_message (self, connection, msg):
    """
    Handles incoming messages

    @overrides SoftwareSwitch.rx_message
    """

    self.connection_in_action = connection
    if not self.check_rights(msg, connection):
      self.log.warn("Message %s not allowed for slave controller %d", msg,
                    connection.ID)
      self.send_vendor_error(connection)
    else:
      SoftwareSwitch.rx_message(self, connection, msg)

    self.connection_in_action = None
Exemplo n.º 5
0
 def _rx_vendor (self, vendor, connection):
   self.log.debug("Vendor %s %s", self.name, str(vendor))
   if vendor.vendor == nx.VENDOR_ID:
     try:
       data = nx.unpack_vendor_data_nx(vendor.data)
       if isinstance(data, nx.role_request_data):
         self.set_role(connection, data.role)
         reply = of.ofp_vendor(xid=vendor.xid, vendor = nx.VENDOR_ID,
                               data = nx.role_reply_data(role = data.role))
         self.send(reply)
         return
     except NotImplementedError:
       self.send_vendor_error(connection)
   else:
     return SoftwareSwitch._rx_vendor(self, vendor)
Exemplo n.º 6
0
 def _rx_vendor (self, vendor, connection):
   self.log.debug("Vendor %s %s", self.name, str(vendor))
   if vendor.vendor == nx.VENDOR_ID:
     try:
       data = nx.unpack_vendor_data_nx(vendor.data)
       if isinstance(data, nx.role_request_data):
         self.set_role(connection, data.role)
         reply = of.ofp_vendor(xid=vendor.xid, vendor = nx.VENDOR_ID,
                               data = nx.role_reply_data(role = data.role))
         self.send(reply)
         return
     except NotImplementedError:
       self.send_vendor_error(connection)
   else:
     return SoftwareSwitch._rx_vendor(self, vendor)
Exemplo n.º 7
0
 def _output_packet_physical(self, packet, port_num):
     self.forward(packet, port_num)
     SoftwareSwitch._output_packet_physical(self, packet, port_num)
Exemplo n.º 8
0
 def __init__(self, *args, **kwargs):
     SoftwareSwitch.__init__(self, *args, **kwargs)
Exemplo n.º 9
0
 def _output_packet_physical(self, packet, port_num):
     self.forward(packet, port_num)
     SoftwareSwitch._output_packet_physical(self, packet, port_num)
Exemplo n.º 10
0
 def __init__(self, *args, **kwargs):
     SoftwareSwitch.__init__(self, *args, **kwargs)