loxi-prep: rewrite vendor tests to use pyloxi message classes
diff --git a/tests/nicira_role.py b/tests/nicira_role.py
index 24606a2..1122a7b 100644
--- a/tests/nicira_role.py
+++ b/tests/nicira_role.py
@@ -11,12 +11,7 @@
 
 from oftest.testutils import *
 
-# Nicira vendor extension constants
-NXT_VENDOR = 0x00002320
-
-NXT_ROLE_REQUEST = 10
-
-NXT_ROLE_VALUE = dict( other=0, slave=1, master=2 )
+NX_ROLE_MASTER = 2
 
 @nonstandard
 class NiciraRoleRequest(base_tests.SimpleDataPlane):
@@ -24,21 +19,10 @@
     Exercise Nicira vendor extension for requesting HA roles
     """
 
-    def nicira_role_request(self, role):
-        """
-        Use the BSN_SET_IP_MASK vendor command to change the IP mask for the
-        given wildcard index
-        """
-        logging.info("Sending role request %s" % role)
-        m = ofp.message.vendor()
-        m.vendor = NXT_VENDOR
-        m.data = struct.pack("!LL", NXT_ROLE_REQUEST, NXT_ROLE_VALUE[role])
-        return m
-
     def runTest(self):
         '''
         For now, we only verify that a response is received.
         '''
-        request = self.nicira_role_request("master")
+        request = ofp.message.nicira_controller_role_request(role=NX_ROLE_MASTER)
         response, pkt = self.controller.transact(request)
         self.assertTrue(response is not None, "No reply to Nicira role request")