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

Beutify the output of dhcpserver command #590

Closed
Karthik-K-N opened this issue Apr 16, 2024 · 3 comments · Fixed by #592
Closed

Beutify the output of dhcpserver command #590

Karthik-K-N opened this issue Apr 16, 2024 · 3 comments · Fixed by #592
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@Karthik-K-N
Copy link
Contributor

What happened:

% pvsadm dhcpserver list -i d6b96219-5bd9-4d9e-b4d5-99e368263746
I0416 11:34:28.759216   25106 root.go:50] Using an API key from IBMCLOUD_API_KEY environment variable
+--------------------------------------+--------------------------------+--------+
|                  ID                  |            NETWORK             | STATUS |
+--------------------------------------+--------------------------------+--------+
| cfed5022-5b49-41eb-8fa7-4bafca983c2e | {ID:0xc0004ecbf0               | ACTIVE |
|                                      | Name:0xc0004ecc00}             |        |
+--------------------------------------+--------------------------------+--------+



% pvsadm dhcpserver get -i d6b96219-5bd9-4d9e-b4d5-99e368263746 --id cfed5022-5b49-41eb-8fa7-4bafca983c2e
I0416 11:37:49.292970   25525 root.go:50] Using an API key from IBMCLOUD_API_KEY environment variable
(*models.DHCPServerDetail)(0xc0003d4630)({
 ID: (*string)(0xc000436ab0)((len=36) "cfed5022-5b49-41eb-8fa7-4bafca983c2e"),
 Leases: ([]*models.DHCPServerLeases) (len=1 cap=4) {
  (*models.DHCPServerLeases)(0xc000436ac0)({
   InstanceIP: (*string)(0xc000436ad0)((len=12) "192.168.0.10"),
   InstanceMacAddress: (*string)(0xc000436ae0)((len=17) "fa:0b:88:5b:eb:20")
  })
 },
 Network: (*models.DHCPServerNetwork)(0xc000436b00)({
  ID: (*string)(0xc000436b10)((len=36) "61308d9e-ef93-4acf-bbe6-190a858ea724"),
  Name: (*string)(0xc000436b20)((len=36) "DHCPSERVERcapi-karthik-16041_Private")
 }),
 Status: (*string)(0xc000436b30)((len=6) "ACTIVE")
})

What you expected to happen:

Pretty print the table with valid and necessary information

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • pvsadm version (use pvsadm version):
  • Environment - On-Prem or IBM PowerVS:
  • OS (e.g: cat /etc/os-release):
  • Kernel (e.g. uname -a):
  • Others:
@Karthik-K-N Karthik-K-N added the kind/bug Categorizes issue or PR as related to a bug. label Apr 16, 2024
@kishen-v
Copy link
Contributor

/assign

@kishen-v
Copy link
Contributor

Kishens-MacBook-Pro➜  bin : pretty-dhcp ✘:  ./pvsadm dhcpserver list --instance-id 549cae6a-d568-4c56-9977-1acc084bd4fa
I0416 18:53:46.368742   85059 root.go:50] Using an API key from IBMCLOUD_API_KEY environment variable
+--------------------------------------+--------------------------------------+----------------------------------------------------+--------+
|                  ID                  |              NETWORK ID              |                    NETWORK NAME                    | STATUS |
+--------------------------------------+--------------------------------------+----------------------------------------------------+--------+
| b8b0ae74-9b06-44fa-8ab7-d723db9bdb25 | 12ba2f3e-135e-4659-ac40-644126f2ddcc | DHCPSERVERbdaab417b86d4c0f927bf130c2a6e114_Private | ACTIVE |
+--------------------------------------+--------------------------------------+----------------------------------------------------+--------+


The get command does not contain the Network ID field, as the same is available from `list` command

Kishens-MacBook-Pro➜  bin : pretty-dhcp ✘ : ./pvsadm dhcpserver get --instance-id 549cae6a-d568-4c56-9977-1acc084bd4fa --id b8b0ae74-9b06-44fa-8ab7-d723db9bdb25
I0416 18:53:57.506791   85095 root.go:50] Using an API key from IBMCLOUD_API_KEY environment variable
+--------------------------------------+--------------------------------+----------------------------------------------------+--------+
|                  ID                  |            IP - MAC            |                    NETWORK NAME                    | STATUS |
+--------------------------------------+--------------------------------+----------------------------------------------------+--------+
| b8b0ae74-9b06-44fa-8ab7-d723db9bdb25 | 192.168.0.10 -                 | DHCPSERVERbdaab417b86d4c0f927bf130c2a6e114_Private | ACTIVE |
|                                      | fa:16:3e:87:b1:64              |                                                    |        |
+--------------------------------------+--------------------------------+----------------------------------------------------+--------+


Kishens-MacBook-Pro➜  bin : pretty-dhcp ✘   ./pvsadm dhcpserver list --instance-id 9a344d8e-49c6-4307-9303-471c8bd1844a
I0416 19:17:25.934982   85957 root.go:50] Using an API key from IBMCLOUD_API_KEY environment variable
I0416 19:17:30.385736   85957 list.go:60] There are no DHCP servers associated with the instance id provided.

@Karthik-K-N
Copy link
Contributor Author

Thats really quick thanks. Just a query do you think for

./pvsadm dhcpserver get --instance-id 549cae6a-d568-4c56-9977-1acc084bd4fa --id b8b0ae74-9b06-44fa-8ab7-d723db9bdb25

We need to display the id, Any how we are querying details with the id only.
How about displaying only network name, status, mac ip?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants