Junos OS

Error during NETCONF edit-config delete operation for VLAN

  • 1.  Error during NETCONF edit-config delete operation for VLAN

    Posted 10-05-2020 07:44

    The device I am working with is an MX2020.  VLAN 50 has been added to interface et-10/1/0 via the following NETCONF RPC:

    <rpc>
      <edit-config>
        <target>
          <candidate/>
        </target>
        <config>
          <configuration>
            <interfaces xmlns="http://yang.juniper.net/junos/conf/interfaces">
              <interface>
                <name>et-10/1/0</name>
                  <unit>
                    <name>50</name>
                    <vlan-id>50</vlan-id>
                  </unit>
              </interface>
            </interfaces>
          </configuration>
        </config>
      </edit-config>
    </rpc>
    ]]>]]>

    An attempt to delete VLAN 50 is made via RPC:

    <rpc>
      <edit-config>
        <target>
          <candidate/>
        </target>
        <config>
          <configuration>
            <interfaces xmlns="http://yang.juniper.net/junos/conf/interfaces">
              <interface>
                <name>et-10/1/0</name>
                  <unit>
                    <name operation="delete">50</name>
                    <vlan-id operation="delete">50</vlan-id>
                  </unit>
              </interface>
            </interfaces>
          </configuration>
        </config>
      </edit-config>
    </rpc>
    ]]>]]>

    However, an rpc-error is raised, complaining about missing <rpc> tags, of which both the open and closing tag are present:

    <rpc>
    <nc:rpc-reply xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/19.3R0/junos">
      <edit-config>
        <target>
          <candidate/>
        </target>
        <config>
          <configuration>
            <interfaces xmlns="http://yang.juniper.net/junos/conf/interfaces">
              <interface>
                <name>et-10/1/0</name>
                  <unit>
                    <name operation="delete">50</name>
                    <vlan-id operation="delete">50</vlan-id>
                  </unit>
    <nc:rpc-error>
    <nc:error-type>protocol</nc:error-type>
    <nc:error-tag>operation-failed</nc:error-tag>
    <nc:error-severity>error</nc:error-severity>
    <nc:error-message>syntax error, expecting &lt;rpc&gt; or &lt;/rpc&gt;</nc:error-message>
    <nc:error-info>
    <nc:bad-element>unit</nc:bad-element>
    </nc:error-info>
    </nc:rpc-error>
              </interface>
            </interfaces>
          </configuration>
        </config>
      </edit-config>
    </rpc>
    ]]>]]></nc:rpc-reply>
    ]]>]]>

    While searching for information about what could be wrong, I stumbled across another Juniper community post, which was for a different device.  The suggested solution was to leave the VLAN tag out of the <vlan-id> section.  I tried that, with the following result:

    <rpc>
      <edit-config>
    <nc:rpc-reply xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/19.3R0/junos">
        <target>
          <candidate/>
        </target>
        <config>
          <configuration>
            <interfaces xmlns="http://yang.juniper.net/junos/conf/interfaces">
              <interface>
                <name>et-10/1/0</name>
                  <unit>
                    <name operation="delete">50</name>
                    <vlan-id operation="delete"></vlan-id>
                  </unit>
              </interface>
            </interfaces>
          </configuration>
        </config>
    <nc:ok/>
      </edit-config>
    </rpc>
    ]]>]]></nc:rpc-reply>

    Which appears OK, but upon commit, receive the following error:

    <rpc>
      <commit/>
    </rpc>
    ]]>]]><nc:rpc-reply xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/19.3R0/junos">
    <commit-results>
    <routing-engine junos:style="show-name">
    <name>re0</name>
    <nc:rpc-error>
    <nc:error-type>protocol</nc:error-type>
    <nc:error-tag>operation-failed</nc:error-tag>
    <nc:error-severity>error</nc:error-severity>
    <source-daemon>
    dcd
    </source-daemon>
    <nc:error-path>
    [edit interfaces et-10/1/0]
    </nc:error-path>
    <nc:error-info>
    <nc:bad-element>
    unit 50
    </nc:bad-element>
    </nc:error-info>
    <nc:error-message>
     VLAN-ID must be specified on tagged ethernet interfaces
    </nc:error-message>
    </nc:rpc-error>
    <nc:rpc-error>
    <nc:error-type>protocol</nc:error-type>
    <nc:error-tag>operation-failed</nc:error-tag>
    <nc:error-severity>error</nc:error-severity>
    <nc:error-message>
    configuration check-out failed
    </nc:error-message>
    </nc:rpc-error>
    </routing-engine>
    </commit-results>
    </nc:rpc-reply>
    ]]>]]>

    I have also tried deleting the VLAN with just the <name> and <vlan-id> tags specified under <unit>, but those calls don't work either.

     

    Any assistance would be greatly appreciated!