01-30-2025 03:31 AM - edited 01-30-2025 03:43 AM
OS: 17.9.5
Model(s): C9200CX-8UXG-2X and C9300-48UN-E
I attempted to update the hostname using NETCONF and the python YDK with the default-operation set to 'replace' with no success. (I have no problems with the 'merge' operation).
Any help is greatly appreciated.
The steps taken were:
1. Copy running config to candidate datastore.
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><copy-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<target>
<candidate/>
</target>
<source>
<running/>
</source>
</copy-config>
</rpc>
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="3">
<ok/>
</rpc-reply>
2. Update candidate datastore with the new hostname. Default operation 'replace'
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><edit-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<target>
<candidate/>
</target>
<default-operation>replace</default-operation>
<config><native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
<hostname>RSW_032TESTTEST</hostname>
</native>
</config>
</edit-config>
</rpc>
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="4">
<ok/>
</rpc-reply>
3. Validate candidate datastore
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><validate xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<source>
<candidate/>
</source>
</validate>
</rpc>
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="5">
<ok/>
</rpc-reply>
4. Try to commit. This returns a series of 'bad-command' errors which have nothing to do with the operation I'm attempting to make.
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><commit xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"/>
</rpc>
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="6">
<rpc-error>
<error-type>application</error-type>
<error-tag>invalid-value</error-tag>
<error-severity>error</error-severity>
<error-message xml:lang="en">inconsistent value: Device refused one or more commands</error-message>
<error-info>
<severity xmlns="http://cisco.com/yang/cisco-ia">error_cli</severity>
<detail xmlns="http://cisco.com/yang/cisco-ia">
<bad-cli>
<bad-command>no interface Vlan1</bad-command>
<error-location>14</error-location>
<parser-response>
% Default interface VLAN 1 may not be deleted.</parser-response>
<parser-context>no interface Vlan1</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no vrf definition Mgmt-vrf</bad-command>
<error-location>7</error-location>
<parser-response>
% Management interface VRF Mgmt-vrf can not be removed.
</parser-response>
<parser-context>no vrf definition Mgmt-vrf</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no ip nbar classification dns classify-by-domain</bad-command>
<error-location>7</error-location>
<parser-response/>
<parser-context>no ip nbar classification dns classify-by-domain</parser-context>
</bad-cli>
<bad-cli>
<bad-command> no service-policy input system-cpp-policy</bad-command>
<error-location>0</error-location>
<parser-response/>
<parser-context>control-plane
no service-policy input system-cpp-policy</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no policy-map system-cpp-policy</bad-command>
<error-location>14</error-location>
<parser-response/>
<parser-context>no policy-map system-cpp-policy</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-default</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-default is being used</parser-response>
<parser-context>no class-map match-any system-cpp-default</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-data</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-data is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-data</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-dhcp-snooping</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-dhcp-snooping is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-dhcp-snooping</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-dot1x-auth</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-dot1x-auth is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-dot1x-auth</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-ewlc-control</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-ewlc-control is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-ewlc-control</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-forus</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-forus is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-forus</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-high-rate-app</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-high-rate-app is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-high-rate-app</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-ios-feature</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-ios-feature is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-ios-feature</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-ios-routing</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-ios-routing is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-ios-routing</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-l2-control</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-l2-control is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-l2-control</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-l2lvx-control</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-l2lvx-control is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-l2lvx-control</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-multicast</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-multicast is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-multicast</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-multicast-end-station</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-multicast-end-station is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-multicast-end-station</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-protocol-snooping</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-protocol-snooping is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-protocol-snooping</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-punt-webauth</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-punt-webauth is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-punt-webauth</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-routing-control</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-routing-control is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-routing-control</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-stackwise-virt-control</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-stackwise-virt-control is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-stackwise-virt-control</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-sw-forward</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-sw-forward is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-sw-forward</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-sys-data</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-sys-data is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-sys-data</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-system-critical</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-system-critical is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-system-critical</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no class-map match-any system-cpp-police-topology-control</bad-command>
<error-location>13</error-location>
<parser-response>
% Class-map system-cpp-police-topology-control is being used</parser-response>
<parser-context>no class-map match-any system-cpp-police-topology-control</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no control-plane</bad-command>
<error-location>6</error-location>
<parser-response>
% Removal of control-plane is not permitted</parser-response>
<parser-context>no control-plane</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no aaa common-criteria policy enable_secret_policy</bad-command>
<error-location>7</error-location>
<parser-response/>
<parser-context>no aaa common-criteria policy enable_secret_policy</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no spanning-tree extend system-id</bad-command>
<error-location>18</error-location>
<parser-response/>
<parser-context>no spanning-tree extend system-id</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no license boot level network-essentials addon dna-essentials</bad-command>
<error-location>22</error-location>
<parser-response/>
<parser-context>no license boot level network-essentials addon dna-essentials</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no line con 0</bad-command>
<error-location>8</error-location>
<parser-response>
% Vty line 0 doesn't exist</parser-response>
<parser-context>no line con 0</parser-context>
</bad-cli>
<bad-cli>
<bad-command>no line vty 5 32</bad-command>
<error-location>15</error-location>
<parser-response/>
<parser-context>no line vty 5 32</parser-context>
</bad-cli>
</detail>
</error-info>
</rpc-error>
</rpc-reply>
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide