Update the WMI Script handling Hyper-V friendly port names

This patch ensures that the friendly port name has no more than 16 characters
and also if it is not in use.

The method which checks the WMI jobs has been updated in order to provide
relevant error codes/descriptions.

Methods retrieving the according VM and VM network adapter mapped to an OVS
port have been added as well. They are called:
Get-VMNetworkAdapterByOVSPort
Get-VMByOVSPort

Example of usage:
 2 import-module .\OVS.psm1
 3 $vnic = Get-VMNetworkAdapter test_2_1
 4 $vnic[0] | Set-VMNetworkAdapterOVSPort -OVSPortName ovs-port-1
 5 $vnic[1] | Set-VMNetworkAdapterOVSPort -OVSPortName ovs-port-1
 6 $vnic[0] | Set-VMNetworkAdapterOVSPort -OVSPortName ovs-port-2
 7 $vnic[1] | Set-VMNetworkAdapterOVSPort -OVSPortName ovs-port-1
 8 Get-VMNetworkAdapterByOVSPort ovs-port-1
 9 Get-VMByOVSPort ovs-port-2

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Add meta-flow.inc nx-match.inc to lib/.gitignore

Add the following files:
meta-flow.inc
nx-match.inc
to lib/.gitignore

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-ofctl: Document protocol-specific forms as preferred over tp_src/tp_dst.

The generic form doesn't work in "learn" actions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reported-by: Alex Wang <alexw@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
ovs-vsctl: Allow modifying "immutable" columns if we just created the row.

OVSDB has the concept of "immutable" columns, which are columns whose
values are fixed once a row is inserted.  Until now, ovs-vsctl has not
allowed these columns to be modified at all.  However, this is a little too
strict, because these columns can be set to any value at the time that the
row is inserted.  This commit relaxes the ovs-vsctl requirement, then, to
allow an immutable column's value to be modified if its row has been
inserted within this transaction.

Requested-by: Mukesh Hira <mhira@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/netdev-windows.c: nuke the init function.

The init function is not allowed to call into the kernel datapath
while running unit tests since the kernel datapath is not loaded.
Instead of making the function dummy, it is better to not have it
at all.

Reported-by: Gurucharan Shetty <gshetty@nicira.com>
Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
tests: Check that port status MODIFY messages are generated.

ONF-JIRA: EXT-338
Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
ofp-actions: Support OF1.5 (draft) masked Set-Field, merge with reg_load.

OpenFlow 1.5 (draft) extends the OFPAT_SET_FIELD action originally
introduced in OpenFlow 1.2 so that it can set not just entire fields but
any subset of bits within a field as well.  This commit adds support for
that feature when OpenFlow 1.5 is used.

With this feature, OFPAT_SET_FIELD becomes a superset of NXAST_REG_LOAD.
Thus, this commit merges the implementations of the two actions into a
single ofpact_set_field.

ONF-JIRA: EXT-314
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
nx-match: Use nx_put_header() internally for encoding flow matches.

This will make it easier to support 64-bit OXM experimenter fields.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
tests: Add test for masked set_field action.

ONF-JIRA: EXT-314
Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
nx-match: Speak of 'class' instead of 'vendor' for OXM/NXM.

OXM renamed the 'vendor' field from NXM to the 'class', and uses the term
"experimenter", which OVS usually renders as "vendor" for historical
reasons, as part of the extended 64-bit OXMs.  To reduce confusion, this
commit adopts the OXM terminology for class.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
util: Make hexits_value() support 64-bit integers too.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
nx-match: Add support for experimenter OXM.

OpenFlow 1.2+ defines a means for vendors to define vendor-specific OXM
fields, called "experimenter OXM".  These OXM fields are expressed with a
64-bit OXM header instead of the 32-bit header used for standard OXM (and
NXM).  Until now, OVS has not implemented experimenter OXM, and indeed we
have had little need to do so because of a pair of special 32-bit OXM classes
grandfathered to OVS as part of the OpenFlow 1.2 standardization process.

However, I want to prototype a feature for OpenFlow 1.5 that uses an
experimenter OXM as part of the prototype, so to do this OVS needs to
support experimenter OXM.  This commit adds that support.

Most of this commit is a fairly straightforward change: it extends the type
used for OXM/NXM from 32 to 64 bits and adds code to encode and decode the
longer headers when necessary.  Some other changes are necessary because
experimenter OXMs have a funny idea of the division between "header" and
"body": the extra 32 bits for experimenter OXMs are counted as part of the body
rather than the header according to the OpenFlow standard (even though this
does not entirely make sense), so arithmetic in various places has to be
adjusted, which is the reason for the new functions nxm_experimenter_len(),
nxm_payload_len(), and nxm_header_len().

Another change that calls for explanation is the new function mf_nxm_header()
that has been split from mf_oxm_header().  This function is used in actions
where the space for an NXM or OXM header is fixed so that there is no room
for a 64-bit experimenter type.  An upcoming commit will add new variations
of these actions that can support experimenter OXM.

Testing experimenter OXM is tricky because I do not know of any in
widespread use.  Two ONF proposals use experimenter OXMs: EXT-256 and
EXT-233.  EXT-256 is not suitable to implement for testing because its use
of experimenter OXM is wrong and will be changed.  EXT-233 is not suitable
to implement for testing because it requires adding a new field to struct
flow and I am not yet convinced that that field and the feature that it
supports is worth having in Open vSwitch.  Thus, this commit assigns an
experimenter OXM code point to an existing OVS field that is currently
restricted from use by controllers, "dp_hash", and uses that for testing.
Because controllers cannot use it, this leaves future versions of OVS free
to drop the support for the experimenter OXM for this field without causing
backward compatibility problems.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
ofp-actions: Correct test for OFPVID_PRESENT bit in set_field action.

Reported-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
tests: Add test of double set-field in output action list.

ONF-JIRA: EXT-314
Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-actions: Support experimenter OXMs in Nicira extensions.

Some of the Nicira extension actions include fixed-size 32-bit members that
designate NXM fields.  These actions can't accommodate 64-bit experimenter
OXMs, so we need to figure out some kind of solution.  This commit does
that, in different ways for different actions.

For some actions, I did not think it was worthwhile to worry about
experimenter OXM, so I just disabled use of them.  This is what I did for
bundle, learn, and multipath actions.

Other actions could be gracefully reinterpreted to support experimenter
OXM.  This is true of reg_move, which use NXM headers only at the end of
the action and such that using an experimenter OXM would make the action
longer (which unambigously signals to older OVS that the action is an
error, which is desired behavior since older OVS cannot interpret this
action).  The stack push and pop actions are also in this category.

reg_load was the most frustrating case.  In OpenFlow 1.5 we had already
eliminated this action in favor of OF1.5+ set_field.  In other OpenFlow
versions, though, reg_load is more powerful than set_field because it
can modify partial fields.  This commit therefore adds a new variant of
reg_load, called reg_load2, which is simply OF1.5+ set_field with a Nicira
extension header on it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
cccl: Ignore -fno-strict-aliasing.

Add a case for the gcc flag fno-strict-aliasing into cccl
Under MSVC  Strict aliasing is off by default.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>