@@ -566,7 +566,7 @@ def portize(classifier,switch_to_attrs):
566
566
specialized_rules .append (rule )
567
567
return Classifier (specialized_rules )
568
568
569
- def prioritize (classifier , switches ):
569
+ def prioritize (classifier ):
570
570
"""
571
571
Add priorities to classifier rules based on their ordering.
572
572
@@ -576,13 +576,14 @@ def prioritize(classifier,switches):
576
576
:rtype: Classifier
577
577
"""
578
578
priority = {}
579
- for s in switches :
580
- priority [s ] = 60000
581
579
tuple_rules = list ()
582
580
for rule in classifier .rules :
583
581
s = rule .match ['switch' ]
582
+ try :
583
+ priority [s ] -= 1
584
+ except KeyError :
585
+ priority [s ] = 60000
584
586
tuple_rules .append ((rule .match ,priority [s ],rule .actions ))
585
- priority [s ] -= 1
586
587
return tuple_rules
587
588
588
589
### UPDATE LOGIC
@@ -601,7 +602,7 @@ def nuclear_install(classifier):
601
602
classifier = switchify (classifier ,switches )
602
603
classifier = concretize (classifier )
603
604
classifier = portize (classifier ,switch_to_attrs )
604
- new_rules = prioritize (classifier , switches )
605
+ new_rules = prioritize (classifier )
605
606
606
607
for s in switches :
607
608
self .send_barrier (s )
@@ -643,7 +644,7 @@ def install_diff_rules(classifier):
643
644
classifier = switchify (classifier ,switches )
644
645
classifier = concretize (classifier )
645
646
classifier = portize (classifier ,switch_to_attrs )
646
- new_rules = prioritize (classifier , switches )
647
+ new_rules = prioritize (classifier )
647
648
648
649
# calculate diff
649
650
to_add = list ()
0 commit comments