Hi Pedro,
See below
root@ace35:~# vif --list | awk '/^vif.*OS: vhost0/ {split($1, arr, "\/");
print arr[2];}' | xargs vif --delete
awk: warning: escape sequence `\/' treated as plain `/'
vif: option '--delete' requires an argument
Usage: vif [--create <intf_name> --mac <mac>]
           [--add <intf_name> --mac <mac> --vrf <vrf>
                --type [vhost|agent|physical|virtual]
                --xconnect <physical interface name>
[--policy, --vhost-phys, --dhcp-enable]]
           [--delete <intf_id>]
           [--get <intf_id>][--kernel]
           [--set <intf_id> --vlan <vlan_id> --vrf <vrf_id>]
           [--list]
           [--help]
root@ace35:~# vif --list | awk '/^vif.*OS: vhost0/ {split($1, arr, "\/");
print arr[2];}'
awk: warning: escape sequence `\/' treated as plain `/'

Thanks
Chaitanya

On Wed, Apr 15, 2015 at 11:18 AM, Pedro Marques <[email protected]> wrote:

>
>  On Apr 15, 2015, at 11:03 AM, Chaitanya Pemmaraju <[email protected]>
> wrote:
>
>    Hi,
>  I am trying to delete and add a physical interface using vif command.
>
>  I can delete the interface but the add doesnt seeem to work, see below
> for snapshots.
>
>
>  Try:
>
>  vif --list | awk '/^vif.*OS: vhost0/ {split($1, arr, "\/"); print arr[2];}' 
> | xargs vif --delete
>
>
>
>    Pedro.
>
>    I am running contrail version 1.20-63.
>
>  Thanks
>  Chaitanya
>
> root@ace35:~# vif --list
> vif0/0      OS: eth0 (Speed 10000, Duplex 1)
>             Type:Physical HWaddr:00:1b:21:cf:2b:f8 IPaddr:0
>             Vrf:0 Flags:TcL3 MTU:1514 Ref:2
>             RX packets:1514812  bytes:99977324 errors:0
>             TX packets:16811831  bytes:25368611758 errors:0
>
> vif0/1      OS: vhost0
>             Type:Host HWaddr:00:1b:21:cf:2b:f8 IPaddr:0
>             Vrf:0 Flags:L3 MTU:1514 Ref:3
>             RX packets:16811629  bytes:25368603330 errors:0
>             TX packets:1514808  bytes:99977084 errors:0
>
> vif0/2      OS: pkt0
>             Type:Agent HWaddr:00:00:5e:00:01:00 IPaddr:0
>             Vrf:65535 Flags:L3 MTU:1514 Ref:2
>             RX packets:199  bytes:13930 errors:0
>             TX packets:198  bytes:17424 errors:0
>
> vif0/4351   OS: pkt1
>             Type:Stats HWaddr:00:00:00:00:00:00 IPaddr:0
>             Vrf:65535 Flags:L3L2 MTU:9136 Ref:1
>             RX packets:0  bytes:0 errors:0
>             TX packets:0  bytes:0 errors:0
>
> root@ace35:~#
>
>
> root@ace35:~# vif --delete eth0
>
> root@ace35:~# vif --list
> vif0/1      OS: vhost0
>             Type:Host HWaddr:00:1b:21:cf:2b:f8 IPaddr:0
>             Vrf:0 Flags:L3 MTU:1514 Ref:3
>             RX packets:16811629  bytes:25368603330 errors:0
>             TX packets:1514808  bytes:99977084 errors:0
>
> vif0/2      OS: pkt0
>             Type:Agent HWaddr:00:00:5e:00:01:00 IPaddr:0
>             Vrf:65535 Flags:L3 MTU:1514 Ref:2
>             RX packets:209  bytes:14630 errors:10
>             TX packets:198  bytes:17424 errors:0
>
> vif0/4351   OS: pkt1
>             Type:Stats HWaddr:00:00:00:00:00:00 IPaddr:0
>             Vrf:65535 Flags:L3L2 MTU:9136 Ref:1
>             RX packets:0  bytes:0 errors:0
>             TX packets:0  bytes:0 errors:0
>
> root@ace35:~#
>
> root@ace35:~# ifconfig vhost0
> vhost0    Link encap:Ethernet  HWaddr 00:1b:21:cf:2b:f8
>           inet addr:172.16.35.1  Bcast:172.16.255.255  Mask:255.255.0.0
>           inet6 addr: fe80::21b:21ff:fecf:2bf8/64 Scope:Link
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:1514808 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:16811645 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000
>           RX bytes:99977084 (99.9 MB)  TX bytes:25368604626 (25.3 GB)
>
> root@ace35:~# ifconfig eth0
> eth0      Link encap:Ethernet  HWaddr 00:1b:21:cf:2b:f8
>           inet6 addr: fe80::21b:21ff:fecf:2bf8/64 Scope:Link
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:2876297 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:41187811 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000
>           RX bytes:189836122 (189.8 MB)  TX bytes:62271389234 (62.2 GB)
>
> root@ace35:/etc/contrail# vif --add eth0 --mac 00:1b:21:cf:2b:f8 -vrf 0
> --type physical
> root@ace35:/etc/contrail# vif --add vhost0 --mac 00:1b:21:cf:2b:f8 -vrf 0
> --type vhost --xconnect eth0
> root@ace35:/etc/contrail# vif --list
> vif0/1      OS: vhost0
>             Type:Host HWaddr:00:1b:21:cf:2b:f8 IPaddr:0
>             Vrf:0 Flags:L3L2 MTU:1514 Ref:3
>             RX packets:16811640  bytes:25368604104 errors:11
>             TX packets:1514808  bytes:99977084 errors:0
>
> vif0/2      OS: pkt0
>             Type:Agent HWaddr:00:00:5e:00:01:00 IPaddr:0
>             Vrf:0 Flags:L3L2 MTU:1514 Ref:2
>             RX packets:209  bytes:14630 errors:10
>             TX packets:198  bytes:17424 errors:0
>
> vif0/4351   OS: pkt1
>             Type:Stats HWaddr:00:00:00:00:00:00 IPaddr:0
>             Vrf:65535 Flags:L3L2 MTU:9136 Ref:1
>             RX packets:0  bytes:0 errors:0
>             TX packets:0  bytes:0 errors:0
>
>
>
>  _______________________________________________
> Dev mailing list
> [email protected]
> http://lists.opencontrail.org/mailman/listinfo/dev_lists.opencontrail.org
>
>
>
_______________________________________________
Dev mailing list
[email protected]
http://lists.opencontrail.org/mailman/listinfo/dev_lists.opencontrail.org

Reply via email to