Skip to content

How to to have nested namespace in netsim device? #11

@adrikacang

Description

@adrikacang

I tried to build a netsim that has something like this for the template

<main namespace="http://main.com/ns/yang/main"
           <submain namespace="http://main.com/ns/yang/sub-main">
                   .....
            </submain>
</main>

Is it possible to have this name space? I tried by using augment but seems the submain module is not loaded in main module. I can't find it when setting the cli

in my yang

main module yang 
module Main {
  namespace "http://main.com/ns/yang/main";
  prefix main;

  import ietf-inet-types { prefix inet; }

  revision 2025-09-04 {
    description "Use augmentation";
  }

  grouping native {
    container native {
      container interface {
        container GigabitEthernet {
          list name {
            key "name";
            leaf name {
              type string;
              description "Interface name suffix (e.g., 0/0/0)";
            }
            leaf description {
              type string;
              description "Interface description";
            }
          }
        }

and this is the inner module yang

module submain {
  namespace "http://main.com/ns/yang/sub-main;
  prefix sub-main;

  grouping config-l2-grouping {
      list neighbor {
        key "ip";
        description "Neighbor PE for VFI";
        leaf ip {
          type string;
          description "Neighbor IP address";
        }
        leaf pw-id {
          type string;
          description "Pseudowire ID (e.g., concatenation of bd and vlanid)";
        }
        leaf encapsulation {
          type enumeration {
            enum mpls;
          }
          description "Encapsulation type";
          default mpls;
        }
      }
    }
  }

  augment "/main:native/main:interface/main:GigabitEthernet" {
    container {
        ........................
   }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions