@@ -87,6 +87,7 @@ class Valve:
87
87
'ofchannel_logger' ,
88
88
'recent_ofmsgs' ,
89
89
'_last_advertise_sec' ,
90
+ '_last_fast_advertise_sec' ,
90
91
'_last_packet_in_sec' ,
91
92
'_last_pipeline_flows' ,
92
93
'_packet_in_count_sec' ,
@@ -110,11 +111,7 @@ def __init__(self, dp, logname, metrics, notifier, dot1x):
110
111
self .ofchannel_logger = None
111
112
self .logger = None
112
113
self .recent_ofmsgs = deque (maxlen = 32 )
113
- self ._last_advertise_sec = 0
114
114
self ._last_pipeline_flows = []
115
- self ._last_packet_in_sec = 0
116
- self ._packet_in_count_sec = 0
117
- self ._port_highwater = {}
118
115
self .dp_init ()
119
116
120
117
def port_labels (self , port ):
@@ -153,6 +150,7 @@ def dp_init(self):
153
150
self ._packet_in_count_sec = 0
154
151
self ._last_packet_in_sec = 0
155
152
self ._last_advertise_sec = 0
153
+ self ._last_fast_advertise_sec = 0
156
154
self ._route_manager_by_ipv = {}
157
155
self ._route_manager_by_eth_type = {}
158
156
self ._port_highwater = {}
@@ -517,16 +515,15 @@ def _decode_port_status(reason):
517
515
def advertise (self , now , _other_values ):
518
516
"""Called periodically to advertise services (eg. IPv6 RAs)."""
519
517
ofmsgs = []
520
- if (self .dp .advertise_interval and
521
- now - self ._last_advertise_sec > self .dp .advertise_interval ):
522
- for route_manager in list (self ._route_manager_by_ipv .values ()):
523
- for vlan in list (self .dp .vlans .values ()):
524
- ofmsgs .extend (route_manager .advertise (vlan ))
525
- for port in list (self .dp .lacp_active_ports ):
526
- if port .running ():
527
- pkt = self ._lacp_pkt (port .dyn_last_lacp_pkt , port )
528
- ofmsgs .append (valve_of .packetout (port .number , pkt .data ))
529
- self ._last_advertise_sec = now
518
+ if (not self .dp .advertise_interval or
519
+ now - self ._last_advertise_sec < self .dp .advertise_interval ):
520
+ return ofmsgs
521
+ self ._last_advertise_sec = now
522
+
523
+ for route_manager in list (self ._route_manager_by_ipv .values ()):
524
+ for vlan in list (self .dp .vlans .values ()):
525
+ ofmsgs .extend (route_manager .advertise (vlan ))
526
+
530
527
return ofmsgs
531
528
532
529
def _send_lldp_beacon_on_port (self , port , now ):
@@ -549,19 +546,28 @@ def _send_lldp_beacon_on_port(self, port, now):
549
546
port .dyn_last_lldp_beacon_time = now
550
547
return valve_of .packetout (port .number , lldp_beacon_pkt .data )
551
548
552
- def send_lldp_beacons (self , now , _other_valves ):
553
- """Called periodically to send LLDP beacon packets."""
549
+ def fast_advertise (self , now , _other_valves ):
550
+ """Called periodically to send LLDP/LACP packets."""
554
551
# TODO: the beacon service is specifically NOT to support conventional R/STP.
555
552
# It is intended to facilitate physical troubleshooting (e.g.
556
553
# a standard cable tester can display OF port information).
557
554
# It is used also by stacking to verify stacking links.
558
555
# TODO: in the stacking case, provide an authentication scheme for the probes
559
556
# so they cannot be forged.
560
557
ofmsgs = []
558
+ if (not self .dp .fast_advertise_interval or
559
+ now - self ._last_fast_advertise_sec < self .dp .fast_advertise_interval ):
560
+ return ofmsgs
561
+ self ._last_fast_advertise_sec = now
562
+
563
+ for port in list (self .dp .lacp_active_ports ):
564
+ if port .running ():
565
+ pkt = self ._lacp_pkt (port .dyn_last_lacp_pkt , port )
566
+ ofmsgs .append (valve_of .packetout (port .number , pkt .data ))
567
+
561
568
ports = self .dp .lldp_beacon_send_ports (now )
562
- if ports :
563
- self .logger .debug ('sending LLDP beacons on %s' % ports )
564
- ofmsgs = [self ._send_lldp_beacon_on_port (port , now ) for port in ports ]
569
+ ofmsgs .extend ([self ._send_lldp_beacon_on_port (port , now ) for port in ports ])
570
+
565
571
return ofmsgs
566
572
567
573
def _next_stack_link_state (self , port , now ):
@@ -617,7 +623,7 @@ def _update_stack_link_state(self, port, now, other_valves):
617
623
for valve in [self ] + other_valves :
618
624
valve .flood_manager .update_stack_topo (port_stack_up , self .dp , port )
619
625
620
- def update_stack_link_states (self , now , other_valves ):
626
+ def fast_state_expire (self , now , other_valves ):
621
627
"""Called periodically to verify the state of stack ports."""
622
628
for port in self .dp .stack_ports :
623
629
self ._update_stack_link_state (port , now , other_valves )
0 commit comments