diff --git a/.gitignore b/.gitignore index 534b58c8..b487eaf7 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,6 @@ venv **/vrnetlab.py # Still allow for the common python scripts !common/healthcheck.py -!common/vrnetlab.py \ No newline at end of file +!common/vrnetlab.py + +.envrc \ No newline at end of file diff --git a/dev-notes.md b/dev-notes.md new file mode 100644 index 00000000..dd8bd1d0 --- /dev/null +++ b/dev-notes.md @@ -0,0 +1,11 @@ +# Developer notes + +## vrnetlab module and vscode pylance + +since vrnetlab module is in the `common` dir the pylance extension in vscode will not be able to find the module reference in `launch.py` files. To fix this, add the following to the `settings.json` file in vscode: + +```json +{ + "python.analysis.extraPaths": ["common"] +} +``` diff --git a/sros/docker/launch.py b/sros/docker/launch.py index 8fc1376b..648dd9e4 100755 --- a/sros/docker/launch.py +++ b/sros/docker/launch.py @@ -154,7 +154,7 @@ def line_card_config( "ixr-x1": { "deployment_model": "distributed", # control plane (CPM) - "max_nics": 36, # 32 * qsfp28 + 4 * qsfpdd + "max_nics": 36, # 32 * qsfp28 + 4 * qsfpdd "cp": { "min_ram": 3, "timos_line": "chassis=ixr-x slot=A card=cpm-ixr-x/imm32-qsfp28+4-qsfpdd", @@ -174,7 +174,7 @@ def line_card_config( "ixr-xs": { "deployment_model": "distributed", # control plane (CPM) - "max_nics": 54, # 6 * qsfpdd + 48 * sfp56 + "max_nics": 54, # 6 * qsfpdd + 48 * sfp56 "cp": { "min_ram": 3, "timos_line": "chassis=ixr-x slot=A card=cpm-ixr-x/imm6-qsfpdd+48-sfp56", @@ -194,7 +194,7 @@ def line_card_config( "ixr-x3": { "deployment_model": "distributed", # control plane (CPM) - "max_nics": 36, # 36 * qsfpdd + "max_nics": 36, # 36 * qsfpdd "cp": { "min_ram": 4, "timos_line": "chassis=ixr-x3 slot=A card=cpm-ixr-x/imm36-qsfpdd", @@ -484,15 +484,15 @@ def line_card_config( }, ], }, -### SR-1 FP5 models (six variants with sfp-dd or qsfpdd only): - #SR-1 FP5 - CP Card must include CPM/IOM + ### SR-1 FP5 models (six variants with sfp-dd or qsfpdd only): + # SR-1 FP5 - CP Card must include CPM/IOM "sr-1-46s": { "deployment_model": "distributed", # control plane (CPM) "max_nics": 48, "cp": { "min_ram": 4, - "timos_line": "slot=A chassis=sr-1-46s card=cpm-1x/i40-200g-sfpdd+6-800g-qsfpdd-1", #CP Card must include CPM/IOM + "timos_line": "slot=A chassis=sr-1-46s card=cpm-1x/i40-200g-sfpdd+6-800g-qsfpdd-1", # CP Card must include CPM/IOM }, # line card (IOM/XCM) "lcs": [ @@ -506,14 +506,14 @@ def line_card_config( } ], }, - #SR-1 FP5 - CP Card must include CPM/IOM + # SR-1 FP5 - CP Card must include CPM/IOM "sr-1-92s": { "deployment_model": "distributed", # control plane (CPM) "max_nics": 48, "cp": { "min_ram": 4, - "timos_line": "slot=A chassis=sr-1-92s card=cpm-1x/i80-200g-sfpdd+12-400g-qsfpdd-1", #CP Card must include CPM/IOM + "timos_line": "slot=A chassis=sr-1-92s card=cpm-1x/i80-200g-sfpdd+12-400g-qsfpdd-1", # CP Card must include CPM/IOM }, # line card (IOM/XCM) "lcs": [ @@ -527,14 +527,14 @@ def line_card_config( } ], }, - #SR-1 FP5 - CP Card must include CPM/IOM + # SR-1 FP5 - CP Card must include CPM/IOM "sr-1x-92s": { "deployment_model": "distributed", # control plane (CPM) "max_nics": 48, "cp": { "min_ram": 4, - "timos_line": "slot=A chassis=sr-1x-92s card=cpm-1x/i80-200g-sfpdd+12-800g-qsfpdd-1x", #CP Card must include CPM/IOM + "timos_line": "slot=A chassis=sr-1x-92s card=cpm-1x/i80-200g-sfpdd+12-800g-qsfpdd-1x", # CP Card must include CPM/IOM }, # line card (IOM/XCM) "lcs": [ @@ -548,7 +548,7 @@ def line_card_config( } ], }, - #SR-1 FP5 + # SR-1 FP5 "sr-1-24d": { "deployment_model": "distributed", # control plane (CPM) @@ -569,14 +569,14 @@ def line_card_config( } ], }, - #SR-1 FP5 + # SR-1 FP5 "sr-1-48d": { "deployment_model": "distributed", # control plane (CPM) "max_nics": 48, "cp": { "min_ram": 4, - "timos_line": "slot=A chassis=sr-1-48D card=cpm-1x/i48-400g-qsfpdd-1", #CP Card must include CPM/IOM + "timos_line": "slot=A chassis=sr-1-48D card=cpm-1x/i48-400g-qsfpdd-1", # CP Card must include CPM/IOM }, # line card (IOM/XCM) "lcs": [ @@ -590,7 +590,7 @@ def line_card_config( } ], }, - #SR-1 FP5 + # SR-1 FP5 "sr-1x-48d": { "deployment_model": "distributed", # control plane (CPM) @@ -630,19 +630,16 @@ def line_card_config( # SR OS Classic CLI common configuration SROS_CL_COMMON_CFG = """ /configure system name {name} -/configure system netconf no shutdown /configure system security profile \"administrative\" netconf base-op-authorization lock /configure system login-control ssh inbound-max-sessions 30 -/configure system management-interface yang-modules no nokia-modules -/configure system management-interface yang-modules nokia-combined-modules /configure system management-interface yang-modules no base-r13-modules +/configure system netconf auto-config-save +/configure system netconf no shutdown /configure system grpc allow-unsecure-connection /configure system grpc gnmi auto-config-save /configure system grpc gnmi no shutdown /configure system grpc rib-api no shutdown /configure system grpc no shutdown -/configure system netconf auto-config-save -/configure system netconf no shutdown /configure system security profile "administrative" netconf base-op-authorization kill-session /configure system security profile "administrative" netconf base-op-authorization lock /configure system snmp packet-size 9216 @@ -655,6 +652,7 @@ def line_card_config( /configure system security snmp community "public" r version v2c """ + # SR OS Model-Driven CLI common configuration SROS_MD_COMMON_CFG = """ /configure system name {name} @@ -665,7 +663,6 @@ def line_card_config( /configure system grpc allow-unsecure-connection /configure system grpc gnmi auto-config-save true /configure system grpc rib-api admin-state enable -/configure system management-interface netconf admin-state enable /configure system management-interface netconf auto-config-save true /configure system management-interface snmp packet-size 9216 /configure system management-interface snmp streaming admin-state enable @@ -677,6 +674,27 @@ def line_card_config( /configure system security snmp community "public" version v2c """ + +# get_version_specific_config returns the version specific configuration +# based on the release number. +def get_version_specific_config(major_version: int): + # releases <=22 boot with the classic CLI config by default + if major_version <= 22: + return """ +/configure system management-interface yang-modules no nokia-submodules +/configure system management-interface yang-modules nokia-combined-modules +""" + # 23.x releases use the Model-Driven CLI by default + if major_version == 23: + return """ +/configure system management-interface netconf admin-state enable +""" + # releases 24.3.1 and above use a new command to enable netconf server + return """ +/configure system management-interface netconf listen admin-state enable +""" + + # to allow writing config to tftp location we needed to spin up a normal # tftp server in container host system. To access the host from qemu VM # we needed to put SR OS management interface in the container host network namespace @@ -1207,7 +1225,7 @@ def gen_mgmt(self): self.nic_type + ",netdev=br-mgmt,mac=%(mac)s" % {"mac": vrnetlab.gen_mac(0)} ) res.append("-netdev") - res.append("bridge,br=br-mgmt,id=br-mgmt" % {"i": 0}) + res.append("bridge,br=br-mgmt,id=br-mgmt") # add virtio NIC for internal control plane interface to vFPC res.append("-device") @@ -1474,11 +1492,10 @@ def getDefaultConfig() -> str: """Returns the default configuration for the system based on the SR OS version. SR OS >=23 uses model-driven configuration, while SR OS <=22 uses classic configuration. """ - if SROS_VERSION.major <= 22: - return SROS_CL_COMMON_CFG + return SROS_CL_COMMON_CFG + get_version_specific_config(SROS_VERSION.major) - return SROS_MD_COMMON_CFG + return SROS_MD_COMMON_CFG + get_version_specific_config(SROS_VERSION.major) if __name__ == "__main__":