Created
November 6, 2015 09:46
-
-
Save tudang/31355858dd0365e075a6 to your computer and use it in GitHub Desktop.
A fix for bmv2 adding multicast node with a list of ports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/targets/simple_switch/sswitch_CLI.py b/targets/simple_switch/sswitch_CLI.py | |
index f67fc5f..eb0165c 100644 | |
--- a/targets/simple_switch/sswitch_CLI.py | |
+++ b/targets/simple_switch/sswitch_CLI.py | |
@@ -41,6 +41,8 @@ class SimpleSwitchAPI(runtime_CLI.RuntimeAPI): | |
def main(): | |
args = runtime_CLI.get_parser().parse_args() | |
+ args.pre = runtime_CLI.PreType.SimplePreLAG | |
+ | |
runtime_CLI.load_json(args.json) | |
services = runtime_CLI.RuntimeAPI.get_thrift_services(args.pre) | |
diff --git a/tools/runtime_CLI.py b/tools/runtime_CLI.py | |
index 84dadb9..f1d0bea 100755 | |
--- a/tools/runtime_CLI.py | |
+++ b/tools/runtime_CLI.py | |
@@ -586,13 +586,15 @@ class RuntimeAPI(cmd.Cmd): | |
print "SUCCESS" | |
def ports_to_port_map_str(self, ports): | |
- last_port_num = 0 | |
- port_map_str = "" | |
- for port_num_str in ports: | |
- port_num = int(port_num_str) | |
- port_map_str += "0" * (port_num - last_port_num) + "1" | |
- last_port_num = port_num | |
- return port_map_str[::-1] | |
+ port_list = map(int, ports) | |
+ if not port_list: | |
+ return "" | |
+ max_port = max(port_list) + 1 | |
+ port_map = [0]*max_port | |
+ for p in port_list: | |
+ port_map[p] = 1 | |
+ port_map_str = "".join(str(x) for x in port_map[::-1]) | |
+ return port_map_str | |
def parse_ports_and_lags(self, args): | |
ports = [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment