[openstack-dev] [Horizon] test_launch_instance_post questions

Abishek Subramanian (absubram) absubram at cisco.com
Wed Mar 12 17:45:37 UTC 2014

Hi all, jpich, amotoki and toshi,

I'm including a link to a small set of diff to show you what I'm trying to
It is obviously a small subset of what I want to do.

But to illustrate the issue I am seeing and to help my understanding of
test, all I'm doing is this - I've added a new network in the neutron_data
that is similar to the first network. Then I have replaced the nics
which is needed to launch an instance. It now takes my new network instead
the first network.

However the test fails because when it is run, it is supposed to expect my
new network
but it actually finds the first network in the code.

The problem in code is here -

Lines 700-705:
netids = context.get('network_id', None)
        if netids:
            nics = [{"net-id": netid, "v4-fixed-ip": ""}
                    for netid in netids]
            nics = None

This part is confusing. In the UT environment, can I please get some help
in understanding how this line

seems to always pick the first network when this particular test is run?


On 3/11/14 9:58 AM, "Abishek Subramanian (absubram)" <absubram at cisco.com>

>Can I please get some help with this UT?
>I am having a little issue with the nics argument -
>nics = [{"net-id": netid, "v4-fixed-ip": ""}
>I wish to add a second network to this argument, but somehow
>the UT only picks up the first network.
>Any guidance will be appreciated.
>On 3/6/14 12:06 PM, "Abishek Subramanian (absubram)" <absubram at cisco.com>
>>I had a couple of questions regarding this UT and the
>>JS template that it ends up using.
>>Hopefully someone can point me in the right direction
>>and help me understand this a little better.
>>I see that for this particular UT, we have a total of 3 networks
>>in the network_list (the second network is supposed to be disabled
>>For the nic argument needed by the nova/server_create API though we
>>only pass the first network's net_id.
>>I am trying to modify this unit test so as to be able to accept 2
>>instead of just one. This should be possible yes?
>>We can have two nics in an instance of just one?
>>However, I always see that when the test runs,
>>in code it only finds the first network from the list.
>>This line of code -
>>     if netids:
>>            nics = [{"net-id": netid, "v4-fixed-ip": ""}
>>                    for netid in netids]
>>There's always just one net-id in this dictionary even though I've added
>>a new network in the neutron test_data. Can someone please help me
>>figure out what I might be doing wrong?
>>How does the JS code in horizon.instances.js file work?
>>I assume this is where the network list is obtained from?
>>How does this translate in the unit test environment?
>>OpenStack-dev mailing list
>>OpenStack-dev at lists.openstack.org

More information about the OpenStack-dev mailing list