[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-9630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15837274#comment-15837274
 ] 

rashmidixit commented on CLOUDSTACK-9630:
-----------------------------------------

Github user sudhansu7 commented on the issue:

    https://github.com/apache/cloudstack/pull/1797
  
    @pdion891 
    The first listNic example is incorrect code. Which has been fixed in this 
PR.  You can use listVirtualMachine command to see the nic response. 
    
    As per code there is no restriction on broadcasturi. If broadcasturi is not 
null then it will part of vm response. 
    So the ListNic should also behave the same way.
    
    '''
    if (details.contains(VMDetails.all) || details.contains(VMDetails.nics)) {
                long nic_id = userVm.getNicId();
                if (nic_id > 0) {
                    NicResponse nicResponse = new NicResponse();
                    nicResponse.setId(userVm.getNicUuid());
                    nicResponse.setIpaddress(userVm.getIpAddress());
                    nicResponse.setGateway(userVm.getGateway());
                    nicResponse.setNetmask(userVm.getNetmask());
                    nicResponse.setNetworkid(userVm.getNetworkUuid());
                    nicResponse.setNetworkName(userVm.getNetworkName());
                    nicResponse.setMacAddress(userVm.getMacAddress());
                    nicResponse.setIp6Address(userVm.getIp6Address());
                    nicResponse.setIp6Gateway(userVm.getIp6Gateway());
                    nicResponse.setIp6Cidr(userVm.getIp6Cidr());
                    if (userVm.getBroadcastUri() != null) {
                        
nicResponse.setBroadcastUri(userVm.getBroadcastUri().toString());
                    }
                    if (userVm.getIsolationUri() != null) {
                        
nicResponse.setIsolationUri(userVm.getIsolationUri().toString());
                    }
                    if (userVm.getTrafficType() != null) {
                        
nicResponse.setTrafficType(userVm.getTrafficType().toString());
                    }
                    if (userVm.getGuestType() != null) {
                        nicResponse.setType(userVm.getGuestType().toString());
                    }
                    nicResponse.setIsDefault(userVm.isDefaultNic());
                    List<NicSecondaryIpVO> secondaryIps = 
ApiDBUtils.findNicSecondaryIps(userVm.getNicId());
                    if (secondaryIps != null) {
                        List<NicSecondaryIpResponse> ipList = new 
ArrayList<NicSecondaryIpResponse>();
                        for (NicSecondaryIpVO ip : secondaryIps) {
                            NicSecondaryIpResponse ipRes = new 
NicSecondaryIpResponse();
                            ipRes.setId(ip.getUuid());
                            ipRes.setIpAddr(ip.getIp4Address());
                            ipList.add(ipRes);
                        }
                        nicResponse.setSecondaryIps(ipList);
                    }
                    nicResponse.setObjectName("nic");
                    userVmResponse.addNic(nicResponse);
                }
            }
    '''
    Is there any 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


> Cannot use listNics API as advertised
> -------------------------------------
>
>                 Key: CLOUDSTACK-9630
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9630
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>            Reporter: Sudhansu Sahu
>
> listNics API for a VM, "type" was not returned within API response. 
> EXPECTED BEHAVIOR
> ==================
> The listNics API response return type of NIC (type), as specified in 
> https://cloudstack.apache.org/api/apidocs-4.8/user/listNics.html
>  
> ACTUAL BEHAVIOR
> ==================
> The listNics API response does not return type of NIC.
> (local) 🐵 > list nics virtualmachineid=a69edaf5-8f21-41ff-8c05-263dc4bd5354 
> count = 1
> nic:
> id = 211e0d46-6b94-4425-99f7-e8e9efea2472
> deviceid = 0
> gateway = 10.1.1.1
> ipaddress = 10.1.1.45
> isdefault = True
> macaddress = 02:00:06:f6:00:01
> netmask = 255.255.255.0
> networkid = c08fddf1-fd77-4810-a062-ea9d03c5c7e6
> virtualmachineid = a69edaf5-8f21-41ff-8c05-263dc4bd5354
>  
>  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to