'How to block host port in RYU controller when anormal traffic is detected?

I am using ryu controller and mininet: I am creating an traffic network classifier using Machine Learning to predict "normal traffic" or "anormal traffic". But now, I have a issue in "how to block the port of the victim host when the traffic is anormal?"

This is my partial code:

*if normal_traffic: self.logger.info("Normal Traffic...")

elif anormal_traffic: self.logger.info("Anormal Traffic Detected...") #How to add mitigation rules?*



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source