community.network.ce_netconf (5.0.2) — module

Run an arbitrary netconf command on HUAWEI CloudEngine switches.

Authors: wangdezhuang (@QijunPan)

Install collection

Install with ansible-galaxy collection install community.network:==5.0.2


Add to requirements.yml

  collections:
    - name: community.network
      version: 5.0.2

Description

Sends an arbitrary netconf command on HUAWEI CloudEngine switches.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.

- name: CloudEngine netconf test
  hosts: cloudengine
  connection: local
  gather_facts: false

  tasks:

  - name: "Netconf get operation"
    community.network.ce_netconf:
      rpc: get
      cfg_xml: '<filter type="subtree">
                  <vlan xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
                    <vlans>
                      <vlan>
                        <vlanId>10</vlanId>
                        <vlanif>
                          <ifName></ifName>
                          <cfgBand></cfgBand>
                          <dampTime></dampTime>
                        </vlanif>
                      </vlan>
                    </vlans>
                  </vlan>
                </filter>'

  - name: "Netconf edit-config operation"
    community.network.ce_netconf:
      rpc: edit-config
      cfg_xml: '<config>
                    <aaa xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
                      <authenticationSchemes>
                        <authenticationScheme operation="create">
                          <authenSchemeName>default_wdz</authenSchemeName>
                          <firstAuthenMode>local</firstAuthenMode>
                          <secondAuthenMode>invalid</secondAuthenMode>
                        </authenticationScheme>
                      </authenticationSchemes>
                    </aaa>
                   </config>'

  - name: "Netconf execute-action operation"
    community.network.ce_netconf:
      rpc: execute-action
      cfg_xml: '<action>
                     <l2mc xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
                       <l2McResetAllVlanStatis>
                         <addrFamily>ipv4unicast</addrFamily>
                       </l2McResetAllVlanStatis>
                     </l2mc>
                   </action>'

Inputs

    
rpc:
    choices:
    - get
    - edit-config
    - execute-action
    - execute-cli
    description:
    - The type of rpc.
    required: true

cfg_xml:
    description:
    - The config xml string.
    required: true

Outputs

changed:
  description: check to see if a change was made on the device
  returned: always
  sample: true
  type: bool
end_state:
  description: k/v pairs of aaa params after module execution
  returned: always
  sample:
    result:
    - ok
  type: dict