ttafsir / evengsdk

Open source Python library and command line utilities for EVE-NG API
https://ttafsir.github.io/evengsdk/
MIT License
63 stars 14 forks source link

[BUG] configuration enable not working for eve-ng CLI #167

Open UchihaItachiSama opened 2 years ago

UchihaItachiSama commented 2 years ago

Describe the bug

Python 3.9.1
eve-ng, version 0.2.7

When using eve-ng CLI app to create topology the configuration enable is not working.

To Reproduce

following is the topology definition file:

---
  name: AVD_LAB_TESTING
  description: EVPN AVD_LAB_TESTING
  path: "/himanshu/"
  author: "himanshu"
  nodes:
    - name: DC1_SPINE1
      template: veos
      image: veos-4.28.1F
      node_type: qemu
      left: 405
      top: 216
      cpu: 2
      ram: 3072
      configuration:
        file: configs/DC1_SPINE1.cfg
    - name: JumpBox
      template: veos
      image: veos-4.28.1F
      node_type: qemu
      left: 702
      top: 51
      cpu: 2
      ram: 2048
      ethernet: 11
  networks:
    - name: Net
      network_type: pnet0
      visibility: 1
      top: 36
      left: 243
  links:
    network:
      - {"src": "JumpBox", "src_label": "Mgmt1", "dst": "Net"}
    node:
      - {"src": "DC1_SPINE1", "src_label": "Mgmt1", "dst": "JumpBox", "dst_label": "Eth1", "media": "ethernet"}
(source .env && eve-ng lab create-from-topology -t templates/evpn-a-a-mh.yml)

[21:43:12] Lab created: /himanshu//AVD_LAB_TESTING.unl                                                                                                             commands.py:452
[21:43:13] node DC1_SPINE1 completed                                                                                                                               commands.py:202
           node JumpBox completed                                                                                                                                  commands.py:202
           network Net completed. ID: 1                                                                                                                            commands.py:226
[21:43:14] link JumpBox:Mgmt1 -> Net completed                                                                                                                     commands.py:146
[21:43:15] link DC1_SPINE1:Mgmt1 <-> JumpBox:Eth1 completed                                                                                                        commands.py:166

Expected behavior

We can see the config is uploaded,

(source .env && eve-ng node config --node-id 2 --path himanshu/AVD_LAB_TESTING.unl)

!RANCID-CONTENT-TYPE: arista
!
vlan internal order ascending range 1006 1199
!
transceiver qsfp default-mode 4x10G
!
service routing protocols model multi-agent
!
hostname DC1_SPINE1
<snipped>

but seems the enable_node_config is not getting invoked:

(source .env && eve-ng node read --node-id 2 --path himanshu/AVD_LAB_TESTING.unl)

{
  "console": "telnet",
  "config": "0",
  "delay": 0,
  "left": 405,
  "icon": "AristaSW.png",
  "image": "veos-4.28.1F",
  "name": "DC1_SPINE1",
  "status": 0,
  "template": "veos",
  "type": "qemu",
  "top": 216,
  "url": "telnet://<snipped>:33538",
  "cpulimit": 1,
  "cpu": 2,
  "ethernet": 9,
  "ram": 3072,
  "uuid": "fc459b6c-7f18-4c04-8049-97fc2133fa62",
  "qemu_options": "-machine type=pc,accel=kvm -serial mon:stdio -nographic -display none -no-user-config -rtc base=utc -boot order=d",
  "qemu_version": "4.1.0",
  "qemu_arch": "x86_64",
  "qemu_nic": ""
}

Screenshots If applicable, add screenshots to help explain your problem.

Additional context

It seems there was a previous issue logged for this where the fix #98 was added to devel branch

but in the master we can see the function is different:

 190   │     # configure node
 191   │     if resp["status"] == "success" and config:
 192   │         node_id = resp["data"]["id"]
 193   │         resp = client.api.upload_node_config(path, node_id, config)
 194   │         if resp["status"] == "success":
 195   │             if config := topology.get_node_config(node["name"]):
 196   │                 node_id = resp["data"]["id"]
 197   │                 resp = client.api.upload_node_config(topology.path, node_id, config)
 198   │                 if resp["status"] == "success":
 199   │                     client.api.enable_node_config(topology.path, node_id)