Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sonic docs refresh and introduction of sonic-vm #2120

Merged
merged 9 commits into from
Jul 3, 2024
Merged

Sonic docs refresh and introduction of sonic-vm #2120

merged 9 commits into from
Jul 3, 2024

Conversation

hellt
Copy link
Member

@hellt hellt commented Jul 2, 2024

No description provided.

@hellt
Copy link
Member Author

hellt commented Jul 3, 2024

@adam-kulagowski do you have an example how ports are mapped in Sonic?
A tiny lab with IP connectivity would be great

something based on this

name: sonic
topology:
  nodes:
    sonic:
      kind: sonic-vm
      image: vrnetlab/vr-sonic:202405
    linux:
      kind: linux
      image: alpine:3

  links:
    - endpoints: [sonic:eth1, linux:eth1]

@adam-kulagowski
Copy link
Contributor

adam-kulagowski commented Jul 3, 2024

name: clab
prefix: __lab-name

topology:
  nodes:
    sonic-vm:
      kind: vr-sonic
      startup-config: config/sonic-vm/sonic-vm-ok.json
      image: vrnetlab/vr-sonic:202305
    frr1:
      kind: linux
      image: quay.io/frrouting/frr:9.1.0
      binds:
        - config/frr1/daemons:/etc/frr/daemons
        - config/frr1/frr.conf:/etc/frr/frr.conf
    frr2:
      kind: linux
      image: quay.io/frrouting/frr:9.1.0
      binds:
        - config/frr2/daemons:/etc/frr/daemons
        - config/frr2/frr.conf:/etc/frr/frr.conf
    PC1:
      kind: linux
      image: praqma/network-multitool:latest
      exec:
        - ip addr add 192.168.1.10/24 dev eth1
        - ip route add 192.168.0.0/16 via 192.168.1.1
        - ip route add 10.0.0.0/8 via 192.168.1.1
    PC2:
      kind: linux
      image: praqma/network-multitool:latest
      exec:
        - ip addr add 192.168.2.10/24 dev eth1
        - ip route add 192.168.0.0/16 via 192.168.2.1
        - ip route add 10.0.0.0/8 via 192.168.2.1

  links:
    - endpoints: ["sonic-vm:eth1", "frr1:eth1"]
    - endpoints: ["sonic-vm:eth2", "frr2:eth1"]
    - endpoints: ["PC1:eth1", "frr1:eth2"]
    - endpoints: ["PC2:eth1", "frr2:eth2"]

This will create a PC - FRR - SONIC - FRR - PC topology. The only issue here is (and I'm not sure if that's important) that SONiC maps eth1 to Ethernet0, eth2 to Ethernet4 , eth3 to Ethernet8 and so on.

Update: the non continuity in SONiC naming is OK. In VM, SONiC assumes that each interface has 4 lanes, and leaves space for potential cable-breakout :)

@hellt
Copy link
Member Author

hellt commented Jul 3, 2024

@adam-kulagowski can you please drop here a quick memo on how save the configuration that will be suitable for startup-config?

@adam-kulagowski
Copy link
Contributor

@adam-kulagowski can you please drop here a quick memo on how save the configuration that will be suitable for startup-config?

Could You please elaborate? I'm not sure what do You expect.

An example configuration that we use looks like this:

{

    "BGP_DEVICE_GLOBAL": {
        "STATE": {
            "tsa_enabled": "false"
        }
    },
    "DEVICE_METADATA": {
        "localhost": {
            "bgp_asn": "65000",
            "buffer_model": "traditional",
            "default_bgp_status": "up",
            "default_pfcwd_status": "disable",
            "hostname": "sonic1-vs",
            "hwsku": "Force10-S6000",
            "mac": "52:54:00:db:58:04",
            "platform": "x86_64-kvm_x86_64-r0",
            "synchronous_mode": "enable",
            "type": "LeafRouter"
        }
    },

    "INTERFACE": {
        "Ethernet0": {},
        "Ethernet0|10.10.1.1/30": {},
        "Ethernet4": {},
        "Ethernet4|10.10.2.1/30": {}
    },
    "LOOPBACK_INTERFACE": {
        "Loopback0": {},
        "Loopback0|10.1.0.1/32": {}
    },
    "BGP_NEIGHBOR": {
        "10.10.1.2": {
            "rrclient": 0,
            "name": "FRR1",
            "local_addr": "10.10.1.1",
            "nhopself": 1,
            "holdtime": "180",
            "asn": "65001",
            "keepalive": "60"
        },
        "10.10.2.2": {
            "rrclient": 0,
            "name": "FRR2",
            "local_addr": "10.10.2.1",
            "nhopself": 1,
            "holdtime": "180",
            "asn": "65002",
            "keepalive": "60"
        }
    },
    "PORT": {
        "Ethernet0": {
            "admin_status": "up",
            "alias": "GigE0/0",
            "index": "0",
            "lanes": "25,26,27,28",
            "mtu": "9100",
            "speed": "1000"
        },
        "Ethernet4": {
            "admin_status": "up",
            "alias": "GigE0/4",
            "index": "1",
            "lanes": "29,30,31,32",
            "mtu": "9100",
            "speed": "1000"
        }
    },

    "VERSIONS": {
        "DATABASE": {
            "VERSION": "version_3_0_5"
        }
    }
}

And is 1:1 copy from /etc/sonic/config_db.json of running VM. Its a full configuration dump and that file will overwrite the the default config on SONiC.

After that any changes done in VM can be exported with containerlab save

If I misunderstood please let me know.

Copy link

codecov bot commented Jul 3, 2024

Codecov Report

Attention: Patch coverage is 4.65116% with 41 lines in your changes missing coverage. Please review.

Project coverage is 53.55%. Comparing base (757883b) to head (1af3612).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2120      +/-   ##
==========================================
- Coverage   53.73%   53.55%   -0.19%     
==========================================
  Files         163      164       +1     
  Lines       11632    11675      +43     
==========================================
+ Hits         6250     6252       +2     
- Misses       4507     4547      +40     
- Partials      875      876       +1     
Files Coverage Δ
clab/register.go 100.00% <100.00%> (ø)
nodes/sonic_vm/sonic_vm.go 2.38% <2.38%> (ø)

@hellt
Copy link
Member Author

hellt commented Jul 3, 2024

If I misunderstood please let me know.

this was exactly what was missing. Added this to the documentation. Ty

@hellt hellt marked this pull request as ready for review July 3, 2024 19:22
@hellt hellt merged commit 79e2a7e into main Jul 3, 2024
63 of 64 checks passed
@hellt hellt deleted the sonic-refresh branch July 3, 2024 19:23
@hellt hellt mentioned this pull request Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants