Skip to content

Commit

Permalink
[VHD-143] CLI Commands to add or remove tags in a template.
Browse files Browse the repository at this point in the history
- Implement tag operation for adding or removing template tags to/from template config
- Internally we use bulk-edit rpc for both operation to comunicate with uniconfig.

- Bulk edit with operation "merge" (equivalent to patch method) for adding tags to nodes.
- Bulk edit with operation "replace" (equivalent to put method) for removing tags from nodes.

- Example of command:
- tag add template-topology template1 snmp agent merge-tag
- tag remove template-topology template1 networks replace-tag

Signed-off-by: Branislav Malo <[email protected]>
Signed-off-by: Branislav Malo <[email protected]>
  • Loading branch information
BranislavMalo committed Jul 30, 2024
1 parent 10bfaa8 commit 8b82464
Showing 1 changed file with 78 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,84 @@ uniconfig-topology-iosxr>show interfaces interface GigabitEthernet0/0/0/1
}
```
### Tag template
The `tag` operation for adding or removing tags from template.
Options: `add` and `remove`
Then pick `template` under `template-topology`
Base command pattern:
tag add/remove template-topology <template-name>
After base command
**Example** - Tag a leaf-list:
```shell Show untagged services leaf-list
config>show template-topology test-template service-node-groups service-node-group default-sng services
[
"cgnat",
"nextgen-firewall",
"test",
"sdwan"
]
```
```shell Add Tag services leaf-list
config>tag
add (invoke add tag explicitly) remove (invoke remove tag explicitly)

config>tag add template-topology test-template
alarms dhcp-profiles service-node-groups
alias event snmp
confdConfig merge-tag (add merge tag) update-tag (add update tag)
create-tag (add create tag) networks
delete-tag (add delete tag) replace-tag (add replace tag)

config>tag add template-topology test-template service-node-groups service-node-group default-value services replace-tag
```
```shell Show tagged services leaf-list
config>show template-topology test-template service-node-groups service-node-group default-sng services
{
"@": {
"template-tags:operation": "replace-tag"
},
"#": [
"cgnat",
"nextgen-firewall",
"test",
"sdwan"
]
}
```
```shell Remove Tag services leaf-list
config>tag
add (invoke add tag explicitly) remove (invoke remove tag explicitly)

config>tag add template-topology test-template
alarms dhcp-profiles service-node-groups
alias event snmp
confdConfig merge-tag (add merge tag) update-tag (add update tag)
create-tag (add create tag) networks
delete-tag (add delete tag) replace-tag (add replace tag)

config>tag remove template-topology test-template service-node-groups service-node-group default-value services replace-tag
```
```shell Show untagged services leaf-list
config>show template-topology test-template service-node-groups service-node-group default-sng services
[
"cgnat",
"nextgen-firewall",
"test",
"sdwan"
]
```
### Execute UniConfig operation
The `request` command is used to execute UniConfig operations such as `commit`
Expand Down

0 comments on commit 8b82464

Please sign in to comment.