Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decompile missing NIC with static IP #213

Closed
pipoe2h opened this issue Feb 21, 2022 · 1 comment
Closed

Decompile missing NIC with static IP #213

pipoe2h opened this issue Feb 21, 2022 · 1 comment
Labels
bug Something isn't working P1 Critical

Comments

@pipoe2h
Copy link

pipoe2h commented Feb 21, 2022

When decompiling a blueprint that has configured a NIC with static IP, the static IP is not getting decompiled

abhijeetkaurav1st pushed a commit that referenced this issue Mar 9, 2023
(cherry picked from commit b3ee92b4860270872580408e9ac2776ef38b8727)
@abhijeetkaurav1st abhijeetkaurav1st added bug Something isn't working P1 Critical labels Mar 17, 2023
dwivediprab pushed a commit that referenced this issue Mar 15, 2024
### Summary
Include static ip address assosciated with nics in the schema
open issue: #213
decompiled the blueprint with the following nic config:
<img width="1182" alt="Screenshot 2023-10-08 at 3 06 55 PM"
src="https://github.com/ideadevice/calm-dsl/assets/89129891/34eed26b-3a94-43df-a92f-c2a9d3fe492e">

following is the output after decompiling
```
# THIS FILE IS AUTOMATICALLY GENERATED.
# Disclaimer: Please test this file before using in production.
"""
Generated blueprint DSL (.py)
"""

import json  # no_qa
import os  # no_qa

from calm.dsl.builtins import *  # no_qa

# Secret Variables

BP_CRED_c1_PASSWORD = read_local_file("BP_CRED_c1_PASSWORD")

# Credentials
BP_CRED_c1 = basic_cred(
    "admin",
    BP_CRED_c1_PASSWORD,
    name="c1",
    type="PASSWORD",
    default=True,
)

class Service1(Service):

    pass

class vmcalm_timeResources(AhvVmResources):

    memory = 1
    vCPUs = 1
    cores_per_vCPU = 1
    disks = [
        AhvVmDisk.Disk.Scsi.cloneFromImageService(
            "Centos7HadoopMaster.qcow2", bootable=True
        )
    ]
    nics = [
        AhvVmNic.NormalNic.ingress(
            "abc", cluster="auto_cluster_prod_4f683249d95b", ip_endpoints=["10.1.0.9"]
        ),
        AhvVmNic.NormalNic.ingress(
            "vlan.154", cluster="auto_cluster_prod_4f683249d95b"
        ),
    ]

class vmcalm_time(AhvVm):

    name = "vm-@@{calm_time}@@"
    resources = vmcalm_timeResources
    cluster = Ref.Cluster(name="auto_cluster_prod_4f683249d95b")

class VM1(Substrate):

    account = Ref.Account("NTNX_LOCAL_AZ")
    os_type = "Linux"
    provider_type = "AHV_VM"
    provider_spec = vmcalm_time

    readiness_probe = readiness_probe(
        connection_type="SSH",
        disabled=True,
        retries="5",
        connection_port=22,
        address="@@{platform.status.resources.nic_list[0].ip_endpoint_list[0].ip}@@",
        delay_secs="0",
    )

class Package1(Package):

    services = [ref(Service1)]

class d2d34557_deployment(Deployment):

    min_replicas = "1"
    max_replicas = "1"
    default_replicas = "1"

    packages = [ref(Package1)]
    substrate = ref(VM1)

class Default(Profile):

    environments = [Ref.Environment(name="Default Environment")]
    deployments = [d2d34557_deployment]

    @action
    def UntitledAction1(name="Untitled Action1"):

        CalmTask.Exec.ssh(
            name="Task1",
            filename=os.path.join(
                "scripts", "Profile_Default_Action_UntitledAction1_Task_Task1.sh"
            ),
            target=ref(Service1),
        )

class test_nic_bp(Blueprint):

    services = [Service1]
    packages = [Package1]
    substrates = [VM1]
    profiles = [Default]
    credentials = [BP_CRED_c1]

class BpMetadata(Metadata):

    categories = {"TemplateType": "Vm"}

```
also verified that the compile works correctly on the above decompiled
bp, following is the output of compilation

(cherry picked from commit acfb95a0ece7de6234347772fe2b350a26c43a81)
@dwivediprab
Copy link
Collaborator

Issue is fixed in DSL v3.7.2.2 release, Hence closing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1 Critical
Projects
None yet
Development

No branches or pull requests

3 participants