- public void _ofaddname(CommandInterpreter ci) {
- if (switchNamesDB == null)
- switchNamesDB = new HashMap<Long, String>();
- String switchId = ci.nextArgument();
- if (!isValidSwitchId(switchId)) {
- ci.println("Please provide a valid SwithcId");
- return;
- }
- Long sid = getSwitchIDLong(switchId);
- String switchName = ci.nextArgument();
- if (switchName == null) {
- ci.println("Please provide a valid Switch name");
- return;
- }
- switchNamesDB.put(sid, switchName);
- }
-
- public void _ofdeletename(CommandInterpreter ci) {
- if (switchNamesDB == null)
- return;
- String switchId = ci.nextArgument();
- if (!isValidSwitchId(switchId)) {
- ci.println("Please provide a valid SwitchId");
- return;
- }
- Long sid = getSwitchIDLong(switchId);
- switchNamesDB.remove(sid);
- }
-
- public void _ofprintnames(CommandInterpreter ci) {
- if (switchNamesDB == null)
- return;
- for (Long key : switchNamesDB.keySet()) {
- ci.println(key + " -> " + switchNamesDB.get(key) + "\n");
- }
- }
-