Control Plane Command Parser
This is a parser which accepts control-plane commands, for example insert_entry which should be executed by the switch. It's a complete rewrite of the old MatchActionConfig.cpp hand-written parser to be easier to understand and to extend, and less brittle.
Adding new commands
Adding new commands should be relatively straightforward.
- Create a new subclass of Command to represent your command
- Don't forget to override the
processfunction. For convenience this can be done with theOVERRIDE_PROCESSmacro in the class declaration, and by thePROCESSmacro in the.cppfile
- Don't forget to override the
- Register your command with the ControlPlaneAgent interface by adding a
DECLARE_PROCESSline. - In
grammar.y:- Create a polymorphic type for your command in the main
polymorphicsection. - Create a token for your command and associate it to your type in the
Terminal typessection. - Create a production for your command. Follow the examples of
insert_entry_commandand the other pre-existing commands. - Add your command grammar rule to the overall
commandproduction.
- Create a polymorphic type for your command in the main
- In
tokens.lcreate a new reserved word for the command. Look at the insert_entry for an example. - That's it.
