Ejemplo n.º 1
0
  def handle_HELLO (self, con, msg): #S
    # Send features and switch desc requests
    if not self._features_request_sent:
      self._features_request_sent = True
      fr = of.ofp_features_request()

      if self.request_description:
        ss = of.ofp_stats_request()
        ss.body = of.ofp_desc_stats_request()

        con.send(fr.pack() + ss.pack())
      else:
        con.send(fr)
Ejemplo n.º 2
0
    def handle_HELLO(self, con, msg):  #S
        # Send features and switch desc requests
        if not self._features_request_sent:
            self._features_request_sent = True
            fr = of.ofp_features_request()

            if self.request_description:
                ss = of.ofp_stats_request()
                ss.body = of.ofp_desc_stats_request()

                con.send(fr.pack() + ss.pack())
            else:
                con.send(fr)
Ejemplo n.º 3
0
def _timer_func ():
  if len(core.openflow._connections.values())==0:
    # since no switch is connected, clean everything.
    del switches[:]
    hosts.clear()
    switch_desc.clear()
    adjacency.clear()
    link_bw.clear()
    link_bw_total.clear()
    byte.clear()
    byte_r.clear()
    clock.clear()
    flow_stats.clear()
    aggr_stats.clear()
    port_stats.clear()
  for connection in core.openflow._connections.values():
    connection.send(of.ofp_stats_request(body=of.ofp_port_stats_request()))
    connection.send(of.ofp_stats_request(body=of.ofp_aggregate_stats_request()))
    connection.send(of.ofp_stats_request(body=of.ofp_flow_stats_request()))
    connection.send(of.ofp_stats_request(body=of.ofp_desc_stats_request()))
Ejemplo n.º 4
0
def _timer_func ():
  if len(core.openflow._connections.values())==0:
    # since no switch is connected, clean everything.
    del switches[:]
    hosts.clear()
    switch_desc.clear()
    adjacency.clear()
    link_bw.clear()
    link_bw_total.clear()
    byte.clear()
    byte_r.clear()
    clock.clear()
    flow_stats.clear()
    aggr_stats.clear()
    port_stats.clear()
  for connection in core.openflow._connections.values():
    connection.send(of.ofp_stats_request(body=of.ofp_port_stats_request()))
    connection.send(of.ofp_stats_request(body=of.ofp_aggregate_stats_request()))
    connection.send(of.ofp_stats_request(body=of.ofp_flow_stats_request()))
    connection.send(of.ofp_stats_request(body=of.ofp_desc_stats_request()))
Ejemplo n.º 5
0
def _handle_ConnectionUp(event):
    msg = of.ofp_stats_request(body=of.ofp_desc_stats_request())
    msg.type = 0  # For betta bug, can be removed
    event.connection.send(msg)
Ejemplo n.º 6
0
def _handle_ConnectionUp (event):
  msg = of.ofp_stats_request(body=of.ofp_desc_stats_request())
  msg.type = 0 # For betta bug, can be removed
  event.connection.send(msg)
Ejemplo n.º 7
0
 def _send_SwitchDescReq (self, dpid):
   body = of.ofp_desc_stats_request()
   body._type = 0
   msg = of.ofp_stats_request(body=body)
   con = core.openflow.getConnection(dpid)
   con.send(msg.pack())
Ejemplo n.º 8
0
 def _handle_ConnectionUp (self, event):
   log.debug("Switch %s has come up.", dpid_to_str(event.dpid))
   #print event.ofp
   event.connection.send(of.ofp_stats_request(body=of.ofp_port_stats_request()))
   event.connection.send(of.ofp_stats_request(body=of.ofp_flow_stats_request()))
   event.connection.send(of.ofp_stats_request(body=of.ofp_desc_stats_request()))
Ejemplo n.º 9
0
 def _send_SwitchDescReq(self, dpid):
     body = of.ofp_desc_stats_request()
     body._type = 0
     msg = of.ofp_stats_request(body=body)
     con = core.openflow.getConnection(dpid)
     con.send(msg.pack())