NSX|v QoS fix DSCP rule creation

Adding a description & qualifier rule to the backend DSCP rule
This affects the view of the rule in vsphere and the possibility
to edit it manually in vsphere.

Change-Id: I1dde630e8130fc347c7aa7aa26d812a9c635b7ea
This commit is contained in:
Adit Sarfaty 2016-10-28 13:06:04 +03:00
parent 213d9ed402
commit a4c8dd570b

View File

@ -26,6 +26,7 @@ PORTGROUP_PREFIX = 'dvportgroup'
QOS_IN_DIRECTION = 'incomingPackets' QOS_IN_DIRECTION = 'incomingPackets'
QOS_AGENT_NAME = 'dvfilter-generic-vmware' QOS_AGENT_NAME = 'dvfilter-generic-vmware'
API_FIND_ALL_BY_UUID = 'FindAllByUuid' API_FIND_ALL_BY_UUID = 'FindAllByUuid'
DSCP_RULE_DESCRIPTION = 'Openstack Dscp Marking RUle'
class DvsManager(object): class DvsManager(object):
@ -176,11 +177,19 @@ class DvsManager(object):
# create the entire structure # create the entire structure
client_factory = self._session.vim.client.factory client_factory = self._session.vim.client.factory
filter_rule = client_factory.create('ns0:DvsTrafficRule') filter_rule = client_factory.create('ns0:DvsTrafficRule')
filter_rule.description = DSCP_RULE_DESCRIPTION
filter_rule.action = client_factory.create( filter_rule.action = client_factory.create(
'ns0:DvsUpdateTagNetworkRuleAction') 'ns0:DvsUpdateTagNetworkRuleAction')
filter_rule.action.dscpTag = qos_data.dscpMarkValue filter_rule.action.dscpTag = qos_data.dscpMarkValue
# mark only incoming packets (openstack egress = nsx ingress) # mark only incoming packets (openstack egress = nsx ingress)
filter_rule.direction = QOS_IN_DIRECTION filter_rule.direction = QOS_IN_DIRECTION
# Add IP any->any qualifier
qualifier = client_factory.create(
'ns0:DvsIpNetworkRuleQualifier')
qualifier.protocol = 0
qualifier.sourceAddress = None
qualifier.destinationAddress = None
filter_rule.qualifier = [qualifier]
traffic_filter_config = client_factory.create( traffic_filter_config = client_factory.create(
'ns0:DvsTrafficFilterConfig') 'ns0:DvsTrafficFilterConfig')