This repository was archived by the owner on Jun 27, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -558,6 +558,25 @@ def concretize_action(a):
558
558
crs = filter (lambda cr : not cr is None ,crs )
559
559
return Classifier (crs )
560
560
561
+ def check_OF_rules (classifier ):
562
+ def check_OF_rule_has_outport (r ):
563
+ for a in r .actions :
564
+ if not 'outport' in a :
565
+ raise TypeError ('Invalid rule: concrete actions must have an outport' ,str (r ))
566
+ def check_OF_rule_has_compilable_action_list (r ):
567
+ if len (r .actions )< 2 :
568
+ pass
569
+ else :
570
+ moded_fields = set (r .actions [0 ].keys ())
571
+ for a in r .actions :
572
+ fields = set (a .keys ())
573
+ if fields - moded_fields :
574
+ raise TypeError ('Non-compilable rule' ,str (r ))
575
+ for r in classifier .rules :
576
+ check_OF_rule_has_outport (r )
577
+ check_OF_rule_has_compilable_action_list (r )
578
+ return Classifier (classifier .rules )
579
+
561
580
def OF_inportize (classifier ):
562
581
"""
563
582
Specialize classifier to ensure that packets to be forwarded
@@ -642,6 +661,7 @@ def nuclear_install(classifier):
642
661
switches = switch_to_attrs .keys ()
643
662
classifier = switchify (classifier ,switches )
644
663
classifier = concretize (classifier )
664
+ classifier = check_OF_rules (classifier )
645
665
classifier = OF_inportize (classifier )
646
666
new_rules = prioritize (classifier )
647
667
You can’t perform that action at this time.
0 commit comments