OpenIxia / IxNetwork

A central location for IxNetwork sample scripts and utilities. Please also visit http://openixia.com
MIT License
50 stars 59 forks source link

RestPy: Adding a list of values for ip, Mac etc rather than using increment #34

Closed muthvar1 closed 5 years ago

muthvar1 commented 5 years ago

I can’t seem to find any examples or how to add a list of values when using the multivalue wrappers in restpy.

I see examples like below where you can increment with a step value and start value.

ixNetwork.info('Configuring IPv4')

ipv4 = ethernet1.Ipv4.add(Name='Ipv4')

ipv4.Address.Increment(start_value='1.1.1.1', step_value='0.0.0.1')

ipv4.GatewayIp.Increment(start_value='1.1.1.2', step_value='0.0.0.0')

But I want something where I have a list of Ips, and I want to configure them as a list.

ip_list = '56.26.0.2,56.26.1.3,56.26.0.4,56.26.0.18,56.26.0.16,56.26.0.7,56.26.0.8,56.26.0.9,56.26.0.10,56.26.0.11'

ixNetwork.info('Configuring IPv4')

ipv4 = ethernet1.Ipv4.add(Name='Ipv4')

ipv4.Address.SomeFunction(ip_list). <<ß---

in HLT Api we did it using multivalue like below.

ip_list

        if ip_version == 4:

            counter_start='1.1.1.1'

            counter_step='0.0.1.0'

            nest_step='0.1.0.0'

        else:

            counter_start='1:1:1:1:1:1:1:1'

            counter_step='0:0:0:0:1:0:0:0'

            nest_step='0:0:0:1:0:0:0:0'

        import pdb; pdb.set_trace()

        ip_construct = device_group.add_multi_value(pattern='counter',

                                      counter_start=counter_start,

                                      counter_step=counter_step,

                                      counter_direction='increment',

                                      nest_step=nest_step,

                                      nest_owner=topo.topology_handle,

                                      nest_enabled='1',

                                      overlay_value=ip_list,

                                      overlay_value_step=ip_list,

                                      overlay_index=overlay_index,

                                      overlay_index_step=overlay_index_step,

                                      overlay_count=overlay_count)
muthvar1 commented 5 years ago

I may have figured it out a way now, but it seems completely non intuitive, so I need someone to confirm if I am doing the right thing please.

deviceGroup2 = topology1.DeviceGroup.add(Name='DG2', Multiplier='3') ethernet1 = deviceGroup2.Ethernet.add(Name='Eth1')

ethernet1.Mac.Increment(start_value='00:01:01:01:00:01', step_value='00:00:00:00:00:01')

ethernet1.EnableVlans.Single(True)

ixNetwork.info('Configuring vlanID') vlanObj = ethernet1.Vlan.find()[0].VlanId.Increment(start_value=103, step_value=0)

ixNetwork.info('Configuring IPv4') ipv4 = ethernet1.Ipv4.add(Name='Ipv4')

ipv4.Address.Single('56.23.4.5'). <<<--- This step seems completely unnecessary, but without this the ValueList function below will bail out ipv4.Address.ValueList(values=['56.23.4.5','56.23.4.7', '56.23.4.8'])

hubertgee commented 5 years ago

Hi Varghese,

For all support and debug issues, please send an email to support.ix@keysight.com. I opened a support case for you already. Somebody from support should contact you shortly.

Hubert

muthvar1 commented 5 years ago

Hi Hubert, I was specifically requested by Mark and Wed to use the github channel for all queries/issues w.r.t RestPy

Varghese

On Feb 20, 2019, at 5:13 PM, Hubert Gee notifications@github.com wrote:

Hi Varghese,

For all support and debug issues, please send an email to support.ix@keysight.com. I opened a support case for you already. Somebody from support should contact you shortly.

Hubert

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

hubertgee commented 5 years ago

Hi Varghese,

They probably misunderstood your question. They know for sure if you have any support issues, always to open a support case with support and have your case tracked. Use Github issue reporting only for bugs found in scripts.

Thanks, Hubert Gee

From: varghese muthalaly notifications@github.com Sent: Wednesday, February 20, 2019 8:48 PM To: OpenIxia/IxNetwork IxNetwork@noreply.github.com Cc: Hubert Gee hubert.gee@keysight.com; State change state_change@noreply.github.com Subject: Re: [OpenIxia/IxNetwork] RestPy: Adding a list of values for ip, Mac etc rather than using increment (#34)

[EXTERNAL] Hi Hubert, I was specifically requested by Mark and Wed to use the github channel for all queries/issues w.r.t RestPy

Varghese

On Feb 20, 2019, at 5:13 PM, Hubert Gee notifications@github.com<mailto:notifications@github.com> wrote:

Hi Varghese,

For all support and debug issues, please send an email to support.ix@keysight.commailto:support.ix@keysight.com. I opened a support case for you already. Somebody from support should contact you shortly.

Hubert

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FOpenIxia%2FIxNetwork%2Fissues%2F34%23issuecomment-465828500&data=02%7C01%7C%7Cfdfbbd76712341dd7c9608d6979ea6cd%7C63545f2732324d74a44dcdd457063402%7C1%7C0%7C636863104989613893&sdata=JK925C%2BzFR%2BV2O4fM3CBzWuc%2B%2F5cQ%2BL4usQTgee93r4%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAhtYX49JhL874uCpDUMdpPQNdnO33dIPks5vPfrhgaJpZM4bGRAm&data=02%7C01%7C%7Cfdfbbd76712341dd7c9608d6979ea6cd%7C63545f2732324d74a44dcdd457063402%7C1%7C0%7C636863104989613893&sdata=DBw4Wns3n8aJDXznZ7%2FK8XcO4GqR%2Fz6uGoreFb2nges%3D&reserved=0.