<div dir="ltr"><div><div>Thanks, can you post sample on Assigning Multiple Logical Network to Physical Network in Java?<br><br></div>I have create the Logical Network and attached to Cluster. Now i want to Assign or Map this to  Physical Network? <br>
<br></div>Also, How to Bond Two Physical NICs and Map or Assign Multiple Logical Networks. <br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 21, 2014 at 1:37 PM, Moti Asayag <span dir="ltr">&lt;<a href="mailto:masayag@redhat.com" target="_blank">masayag@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">h<br>
<br>
----- Original Message -----<br>
&gt; From: &quot;Tejesh M&quot; &lt;<a href="mailto:tejeshmk@gmail.com">tejeshmk@gmail.com</a>&gt;<br>
&gt; To: &quot;users@oVirt.org&quot; &lt;<a href="mailto:users@ovirt.org">users@ovirt.org</a>&gt;<br>
&gt; Sent: Thursday, February 20, 2014 11:48:56 AM<br>
&gt; Subject: [Users] Creating Logical Network issue - API<br>
&gt;<br>
&gt; Hi ,<br>
&gt;<br>
&gt; I&#39;m trying to create Logical Network and assign it to cluster &amp; want to bond<br>
&gt; this to one of the Network Interface on Host. so that i can isolate my VM<br>
&gt; from other networks.<br>
&gt;<br>
&gt; The issue is even if i set Cluster while creating Logical Network, it is not<br>
&gt; setting the cluster. In Web Admin it is in unset state.<br>
&gt;<br>
&gt; Also, let me know how do i bind this Logical network on Host Interface.<br>
&gt;<br>
&gt; Java code:<br>
&gt;<br>
&gt; Network nw1=new Network();<br>
&gt; VLAN vlan = new VLAN();<br>
&gt; vlan.setId(2000);<br>
&gt; nw1.setVlan(vlan);<br>
&gt; IP ip = new IP();<br>
&gt; ip.setAddress(&quot;192.168.1.151&quot;);<br>
&gt; ip.setGateway(&quot;192.168.1.1&quot;);<br>
&gt; ip.setNetmask(&quot;255.255.255.0&quot;);<br>
<br>
Note that the stated IP above will not be used to set the address on the host itself.<br>
In order to do so you should use either the &#39;setup networks&#39; api on host&#39;s nics level.<br>
(Alternately, you can send POST request to /hosts/{host:id}/nics which utilize the<br>
former api (it is a bit simpler than using the setup networks api).<br>
<br>
Should look like:<br>
    Host host = api.getHosts().get(&quot;host_name&quot;);<br>
    Action action = new Action();<br>
    action.setCheckConnectivity(true); //required for rollback in case of configuration failure<br>
    action.setHostNics(...); // should contain the target configuration<br>
    host.getHostNics().setupnetworks(action);<br>
<br>
where the action should contain the entire desired network configuration.<br>
<br>
You can find various python-sdk example for setup networks on my blog [1]<br>
I&#39;ll post few examples using the java sdk earlier next week.<br>
<br>
[1] <a href="https://motiasayag.wordpress.com/" target="_blank">https://motiasayag.wordpress.com/</a><br>
<br>
&gt; nw1.setIp(ip);<br>
&gt; nw1.setName(&quot;apiNetwork&quot;);<br>
&gt;<br>
&gt; nw1.setDataCenter(api.getDataCenters().get(&quot;testDC&quot;));<br>
&gt; nw1.setCluster(api.getClusters().get(&quot;testCluster&quot;));<br>
&gt;<br>
&gt; org.ovirt.engine.sdk.decorators.Network nw2 = api.getNetworks().add(nw1);<br>
<span class="HOEnZb"><font color="#888888">&gt;<br>
&gt; --<br>
&gt; Thanks &amp; Regards<br>
&gt; Tejesh<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Users mailing list<br>
&gt; <a href="mailto:Users@ovirt.org">Users@ovirt.org</a><br>
&gt; <a href="http://lists.ovirt.org/mailman/listinfo/users" target="_blank">http://lists.ovirt.org/mailman/listinfo/users</a><br>
&gt;<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div>Thanks &amp; Regards</div>
<div>Tejesh</div>
</div>