Exemple #1
0
    def test_PortRef(self):
        # create and initialize a test port
        Port = CTestPort()
        MyRegister = 0
        Port.CreateEntry(0x00ff, "uint32_t", MyRegister, RW, LittleEndian)
        """[ GenApiTest@PortTestSuite_TestPortRef.xml|gxml
            <Port Name="MyPort" >
            </Port>
            <IntReg Name="TestReg">
               <Address>0x00ff</Address>
               <Length>1</Length>
               <AccessMode>RW</AccessMode>
               <pPort>MyPort</pPort>
               <Sign>Unsigned</Sign>
               <Endianess>BigEndian</Endianess>
            </IntReg>
        """

        # create and connect a camera object
        Camera = CNodeMapRef()
        Camera._LoadXMLFromFile("GenApiTest", "PortTestSuite_TestPortRef")
        Camera._Connect(Port, "MyPort")

        # Create a pointer to MyPort, a pointer to the IntReg and a CPortRef object referencing MyPort
        port = Camera._GetNode("MyPort")
        testReg = Camera._GetNode("TestReg")

        # Write and read back using CPortRef
        WriteBuffer = 3

        port.Write(0x00ff, cast_data("uint32_t", LittleEndian, WriteBuffer))
        ReadBuffer = port.Read(0x00ff, sizeof("uint32_t"))
        self.assertTrue(
            cast_buffer("uint32_t", LittleEndian, ReadBuffer) == WriteBuffer)

        # Write and read back using IntReg
        testReg.SetValue(25)
        self.assertTrue(testReg.GetValue() == 25)

        # Write using pointer to IntReg, read back through CPortRef
        testReg.SetValue(42)
        ReadBuffer = port.Read(0x00ff, sizeof("uint32_t"))
        self.assertTrue(
            cast_buffer("uint32_t", LittleEndian, ReadBuffer) == 42)

        # Write through CPortRef, read back through pointer to IntReg
        # The values should only match once the IntReg cache has been invalidated.
        WriteBuffer = 31
        port.Write(0x00ff, cast_data("uint32_t", LittleEndian, WriteBuffer))
        self.assertTrue(testReg.GetValue() != WriteBuffer)

        # Invalidate the port's node cache and test for correct read back
        Port.InvalidateNode()
        self.assertTrue(testReg.GetValue() == WriteBuffer)

        # Make sure the failed write didn't modify the value of the node.
        self.assertTrue(testReg.GetValue() == WriteBuffer)
Exemple #2
0
    def test_PortAccess(self):
        # create and initialize a test port
        Port = CTestPort()
        MyRegister = 42
        Port.CreateEntry(0x00ff, "uint32_t", MyRegister, RW, LittleEndian)
        """[ GenApiTest@PortTestSuite_TestPortAccess.xml|gxml
            <Port Name="MyPort" >
            </Port>
        """
        # create and connect a camera object
        Camera = CNodeMapRef()
        Camera._LoadXMLFromFile("GenApiTest", "PortTestSuite_TestPortAccess")
        Camera._Connect(Port, "MyPort")

        port = Camera._GetNode("MyPort")

        # read back value
        Buffer = port.Read(0x00ff, sizeof("uint32_t"))
        self.assertEqual(MyRegister,
                         cast_buffer("uint32_t", LittleEndian, Buffer))

        # write a new value
        MyNewRegister = 99
        port.Write(0x00ff, cast_data("uint32_t", LittleEndian, MyNewRegister))
        Buffer = port.Read(0x00ff, sizeof("uint32_t"))
        self.assertEqual(MyNewRegister,
                         cast_buffer("uint32_t", LittleEndian, Buffer))
    def test_Callback01Register(self):
        """[ GenApiTest@CallbackTestSuite_TestCallback01Register.xml|gxml
    
        <Register Name="MyRegister">
            <Address>0x0000</Address>
            <Length>1</Length>
            <AccessMode>RW</AccessMode>
            <pPort>Port</pPort>
        </Register>
    
        <Port Name="Port"/>
    
        """

        Camera = CNodeMapRef()
        Camera._LoadXMLFromFile("GenApiTest",
                                "CallbackTestSuite_TestCallback01Register")

        RegVal = 0
        Port = CTestPort()
        Port.CreateEntry(0x0000, "uint8_t", RegVal, RW, LittleEndian)
        Camera._Connect(Port, "Port")

        CallbackUtility.Reset()

        Register01 = Camera.GetNode("MyRegister")

        # register function pointer
        Register(Register01.GetNode(), CallbackUtility.Callback)

        # check if callbacks are fired
        numCalls = 42
        for i in range(0, numCalls):
            Register01.FromString("0xAB")
        self.assertEqual(numCalls, CallbackUtility.Count())
        RegVal = 17
        for i in range(0, numCalls):
            Register01.Set(cast_data("uint8_t", LittleEndian, RegVal))
        self.assertEqual(2 * numCalls, CallbackUtility.Count())
    def test_PortInvalidate(self):
        # if(GenApiSchemaVersion < v1_1)
        #    return
        """[ GenApiTest@CallbackTestSuite_TestPortInvalidate.xml|gxml
    
        <IntReg Name="Invalidator">
            <Address>0x0000</Address>
            <Length>4</Length>
            <AccessMode>RW</AccessMode>
            <pPort>Port</pPort>
            <Sign>Signed</Sign>
            <Endianess>LittleEndian</Endianess>
        </IntReg>
    
        <Integer Name="FloatingInvalidator">
            <Value>0</Value>
        </Integer>
    
        <IntReg Name="Invalidated">
            <Address>0x0004</Address>
            <Length>4</Length>
            <AccessMode>RW</AccessMode>
            <pPort>Port</pPort>
            <Sign>Signed</Sign>
            <Endianess>LittleEndian</Endianess>
        </IntReg>
    
        <Port Name="Port" >
            <pInvalidator>Invalidator</pInvalidator>
            <pInvalidator>FloatingInvalidator</pInvalidator>
        </Port>
    
        """

        Camera = CNodeMapRef()
        Camera._LoadXMLFromFile("GenApiTest",
                                "CallbackTestSuite_TestPortInvalidate")

        # create and initialize a test port
        Port = CTestPort()
        Port.CreateEntry(0x000, "int32_t", 42, RW, LittleEndian)
        Port.CreateEntry(0x004, "int32_t", 42, RW, LittleEndian)

        # connect the node map to the port
        Camera._Connect(Port, "Port")

        CallbackUtility.Reset()

        Invalidator = Camera.GetNode("Invalidator")
        FloatingInvalidator = Camera.GetNode("FloatingInvalidator")
        Invalidated = Camera.GetNode("Invalidated")

        Register(Invalidated.GetNode(), CallbackUtility.Callback)

        # touch the invalidator
        Invalidator.SetValue(80)
        # verify that the values depending on the port were invalidated
        # ie. cache bypassed

        Value = 88
        Port.Write(0x04, cast_data("uint32_t", LittleEndian, Value))
        self.assertEqual(88, Invalidated.GetValue())
        # check if the callback was fired
        self.assertEqual(1, CallbackUtility.Count())

        # the same with floating invalidator
        FloatingInvalidator.SetValue(80)
        Value = 99
        Port.Write(0x04, cast_data("uint32_t", LittleEndian, Value))
        self.assertEqual(99, Invalidated.GetValue())
        self.assertEqual(2, CallbackUtility.Count())
    def test_Callback14(self):
        """[ GenApiTest@CallbackTestSuite_TestCallback14.xml|gxml
    
        <Command Name="MyCommand">
            <pValue>MyCommandReg</pValue>
            <CommandValue>0xff</CommandValue>
        </Command>
    
        <IntReg Name="MyCommandReg">
            <Address>0x10000000</Address>
            <Length>4</Length>
            <AccessMode>RW</AccessMode>
            <pPort>Port</pPort>
            <Cachable>NoCache</Cachable>
            <Sign>Unsigned</Sign>
            <Endianess>LittleEndian</Endianess>
        </IntReg>
    
        <Integer Name="Feature">
            <pValue>FeatureReg</pValue>
        </Integer>
    
        <IntReg Name="FeatureReg">
            <Address>0x10000004</Address>
            <Length>4</Length>
            <AccessMode>RO</AccessMode>
            <pPort>Port</pPort>
            <pInvalidator>MyCommandReg</pInvalidator>
            <Sign>Unsigned</Sign>
            <Endianess>LittleEndian</Endianess>
        </IntReg>
    
        <Port Name="Port"/>
    
        """

        Camera = CNodeMapRef()
        Camera._LoadXMLFromFile("GenApiTest",
                                "CallbackTestSuite_TestCallback14")

        Port = CTestPort()
        Port.CreateEntry(0x10000000, "uint32_t", 0, RW, LittleEndian)
        Port.CreateEntry(0x10000004, "uint32_t", 0, RW, LittleEndian)

        Camera._Connect(Port, "Port")
        # CallbackObject O1

        Cmd = Camera.GetNode("MyCommand")
        Feature = Camera.GetNode("Feature")

        Register(Feature.GetNode(), CallbackUtility.Callback)
        CallbackUtility.Reset()

        # Executing writes MyCommandReg which in turn invalidates FeatureReg and Feature
        # thus reading Feature yields the register value
        Cmd.Execute()
        self.assertEqual(1, CallbackUtility.Count())
        self.assertEqual(0, Feature.GetValue())

        # Polling the Command does not invalidate anything because the command is not yet done
        self.assertFalse(Cmd.IsDone())
        self.assertEqual(1, CallbackUtility.Count())

        # change both registers
        value = 0
        Port.Write(0x10000000, cast_data("uint32_t", LittleEndian, value))
        value = 1234
        Port.Write(0x10000004, cast_data("uint32_t", LittleEndian, value))

        # Polling the command invalidates the command
        self.assertTrue(Cmd.IsDone())
        # this yields a second callback on the command...
        self.assertEqual(2, CallbackUtility.Count())
        # ... and invalidates the Feature since it has a pInvalidales link to the Command
        self.assertEqual(1234, Feature.GetValue())
Exemple #6
0
    def test_RegisterNode(self):
        """[ GenApiTest@RegisterTestSuite_TestRegisterNode.xml|gxml
    
        <Register Name="Register">
            <pAddress>Address</pAddress>
            <pLength>Length</pLength>
            <AccessMode>RW</AccessMode>
            <pPort>Port</pPort>
        </Register>
    
        <IntReg Name="Length">
            <Address>0</Address>
            <Length>4</Length>
            <AccessMode>RW</AccessMode>
            <pPort>Port</pPort>
            <Sign>Unsigned</Sign>
            <Endianess>LittleEndian</Endianess>
        </IntReg>
    
        <IntReg Name="Address">
            <Address>4</Address>
            <Length>4</Length>
            <AccessMode>RW</AccessMode>
            <pPort>Port</pPort>
            <Sign>Unsigned</Sign>
            <Endianess>LittleEndian</Endianess>
        </IntReg>
    
        <Port Name="Port"/>
    
        """

        Camera = CNodeMapRef()
        Camera._LoadXMLFromFile("GenApiTest",
                                "RegisterTestSuite_TestRegisterNode")

        LenVal = 1
        AddrVal = 0x100

        Port = CTestPort()
        Port.CreateEntry(0x0, "uint32_t", LenVal, RW, LittleEndian)
        Port.CreateEntry(0x4, "uint32_t", AddrVal, RW, LittleEndian)
        RegVal = 0x11
        Port.CreateEntry(0x100, "uint8_t", RegVal, RW, LittleEndian)
        RegVal = 0x22
        Port.CreateEntry(0x101, "uint8_t", RegVal, RW, LittleEndian)
        RegVal2 = 0x3344
        Port.CreateEntry(0x102, "uint16_t", RegVal2, RW, LittleEndian)
        Camera._Connect(Port, "Port")

        Len = Camera.GetNode("Length")
        Addr = Camera.GetNode("Address")
        Register = Camera.GetNode("Register")

        # excercise pAddress and pLength
        Byte = cast_buffer("uint8_t", LittleEndian, Register.Get(1))
        self.assertEqual(0x11, Byte)
        Addr.SetValue(0x101)
        Byte = cast_buffer("uint8_t", LittleEndian, Register.Get(1))
        self.assertEqual(0x22, Byte)
        Addr.SetValue(0x102)
        Len.SetValue(2)
        Word = cast_buffer("uint16_t", LittleEndian, Register.Get(2))
        self.assertEqual(0x3344, Word)
        Addr.SetValue(0x100)
        Len.SetValue(1)
        # try to get/set more data than register length
        with self.assertRaises(OutOfRangeException):
            Register.Get(2)
        with self.assertRaises(OutOfRangeException):
            Register.Set(cast_data("uint16_t", LittleEndian, 0xaa55))
Exemple #7
0
    def test_CommandMantis250_sch11(self):
        # <pInvalidator> pointing to a non-register node
        # if(GenApiSchemaVersion == v1_0)
        #    return
        """[ GenApiTest@CommandTestSuite_TestCommandMantis250_sch11.xml|gxml
        <Integer Name="BinningVertical">
          <pValue>pVerticalBinningReg</pValue>
          <Representation>Linear</Representation>
        </Integer>
        <IntReg Name="pVerticalBinningReg">
          <Address>0x4</Address>
          <Length>4</Length>
          <AccessMode>RW</AccessMode>
          <pPort>MyPort</pPort>
          <pInvalidator>Command</pInvalidator>
          <Sign>Unsigned</Sign>
          <Endianess>BigEndian</Endianess>
        </IntReg>
    
        <Command Name="Command">
            <pValue>pUserSetLoadReg</pValue>
            <pCommandValue>CommandValue</pCommandValue>
        </Command>
    
        <Integer Name="CommandValue">
            <Value>42</Value>
        </Integer>
    
        <IntReg Name="pUserSetLoadReg">
          <Address>0x8</Address>
          <Length>4</Length>
          <AccessMode>RW</AccessMode>
          <pPort>MyPort</pPort>
          <Cachable>NoCache</Cachable>
          <Sign>Unsigned</Sign>
          <Endianess>BigEndian</Endianess>
        </IntReg>
    
        <Port Name="MyPort"/>
    
        """
        Camera = CNodeMapRef()

        Camera._LoadXMLFromFile("GenApiTest",
                                "CommandTestSuite_TestCommandMantis250_sch11")

        Port = CTestPort()
        Port.CreateEntry(0x0004, "uint32_t", 2, RW, BigEndian)
        Port.CreateEntry(0x0008, "uint64_t", 0, RW, BigEndian)

        # connect the node map to the port
        Camera._Connect(Port, "MyPort")

        Command = Camera.GetNode("Command")

        Binning = Camera.GetNode("BinningVertical")

        CallbackBinning = CallbackObjectMantis250()
        Register(Binning.GetNode(), CallbackBinning.Callback)

        CallbackCommand = CallbackObjectMantis250()
        Register(Command.GetNode(), CallbackCommand.Callback)

        Command.Execute()
        self.assertEqual(1, CallbackBinning.Count())

        self.assertEqual(False, Command.IsDone())
        self.assertEqual(False, Command.IsDone(False))
        self.assertEqual(1, CallbackBinning.Count())
        self.assertEqual(1, CallbackCommand.Count())

        value = 0
        AccessMode = RO
        Port.UpdateEntry(0x0008, cast_data("uint64_t", LittleEndian, value),
                         AccessMode)

        self.assertEqual(True, Command.IsDone(False))
        self.assertEqual(True, Command.IsDone())
        self.assertEqual(2, CallbackCommand.Count())
        self.assertEqual(2, CallbackBinning.Count())
Exemple #8
0
    def test_CommandMantis250(self):
        """[ GenApiTest@CommandTestSuite_TestCommandMantis250.xml|gxml
    
        <Integer Name="BinningVertical">
          <pValue>VerticalBinningReg</pValue>
          <Representation>Linear</Representation>
        </Integer>
    
        <IntReg Name="VerticalBinningReg">
          <Address>0x4</Address>
          <Length>4</Length>
          <AccessMode>RW</AccessMode>
          <pPort>MyPort</pPort>
          <pInvalidator>UserSetLoadReg</pInvalidator>
          <Sign>Unsigned</Sign>
          <Endianess>BigEndian</Endianess>
        </IntReg>
    
        <Command Name="Command">
          <pValue>UserSetLoadReg</pValue>
          <pCommandValue>CommandValue</pCommandValue>
        </Command>
    
        <Integer Name="CommandValue">
          <Value>42</Value>
        </Integer>
    
        <IntReg Name="UserSetLoadReg">
          <Address>0x8</Address>
          <Length>4</Length>
          <AccessMode>RW</AccessMode>
          <pPort>MyPort</pPort>
          <Cachable>NoCache</Cachable>
          <Sign>Unsigned</Sign>
          <Endianess>BigEndian</Endianess>
        </IntReg>
    
        <Port Name="MyPort"/>
    
        """
        Camera = CNodeMapRef()

        Camera._LoadXMLFromFile("GenApiTest",
                                "CommandTestSuite_TestCommandMantis250")

        Port = CTestPort()
        Port.CreateEntry(0x0004, "uint32_t", 2, RW,
                         BigEndian)  # VerticalBinningReg
        Port.CreateEntry(0x0008, "uint64_t", 0, RW,
                         BigEndian)  # UserSetLoadReg

        # connect the node map to the port
        Camera._Connect(Port, "MyPort")

        Command = Camera.GetNode("Command")

        Binning = Camera.GetNode("BinningVertical")

        CallbackBinning = CallbackObjectMantis250()
        Register(Binning.GetNode(), CallbackBinning.Callback)

        CallbackCommand = CallbackObjectMantis250()
        Register(Command.GetNode(), CallbackCommand.Callback)

        # this writes 42 to the UserSetLoadReg
        # because VerticalBinningReg has a pInvalidates pointer to UserSetLoadReg it is invalidated
        Command.Execute()
        self.assertEqual(1, CallbackCommand.Count())
        self.assertEqual(1, CallbackBinning.Count())

        # since UserSetLoadReg has not change no callback fires on IsDone
        self.assertEqual(False, Command.IsDone())
        self.assertEqual(1, CallbackBinning.Count())
        self.assertEqual(1, CallbackCommand.Count())

        # now we reset UserSetLoadReg
        value = 0
        AccessMode = RO
        Port.UpdateEntry(0x0008, cast_data("uint64_t", LittleEndian, value),
                         AccessMode)

        # on the next IsDone the callback fires
        self.assertEqual(True, Command.IsDone())
        self.assertEqual(2, CallbackCommand.Count())
        self.assertEqual(2, CallbackBinning.Count())
Exemple #9
0
    def test_Command01(self):
        """[ GenApiTest@CommandTestSuite_TestCommand01.xml|gxml
    
        <Category Name="Root">
           <pFeature>command</pFeature>
        </Category>
    
        <Command Name="command">
           <pValue>myIntReg</pValue>
           <CommandValue>0x4321</CommandValue>
        </Command>
    
        <IntReg Name="myIntReg">
            <Address>0x00ff</Address>
            <Length>4</Length>
            <AccessMode>RW</AccessMode>
            <pPort>MyPort</pPort>
            <Sign>Unsigned</Sign>
            <Endianess>BigEndian</Endianess>
        </IntReg>
    
        <Port Name="MyPort"/>
    
        """

        Camera = CNodeMapRef()
        Camera._LoadXMLFromFile("GenApiTest", "CommandTestSuite_TestCommand01")

        # create and initialize a test port
        Port = CTestPort()
        Port.CreateEntry(0x00ff, "uint32_t", 42, RW, BigEndian)

        # connect the node map to the port
        Camera._Connect(Port, "MyPort")

        #
        # Test the ICommand interface
        #

        # retrieve the node and convert it to ICommand
        Node = Camera.GetNode("command")
        Cmd = Node
        self.assertTrue(bool(Node))
        self.assertTrue(bool(Cmd))
        self.assertEqual(intfICommand,
                         Cmd.GetNode().GetPrincipalInterfaceType())

        ##### getproperty of command pointer -
        try:
            ValueStr, AttributeStr = Cmd.GetNode().GetProperty("CommandValue")
        except:
            pass

        # execute function
        Cmd.Execute()
        # is executing?
        self.assertEqual(False, Cmd.IsDone())
        # manipulate the command register in order to simulate a self-resetting toggle
        # CLittleEndian<int32_t> tmp
        tmp_data = Port.Read(0x00ff, sizeof("int32_t"))
        self.assertEqual(0x21430000,
                         cast_buffer("int32_t", LittleEndian, tmp_data))
        tmp = 0
        Port.Write(0x00ff, cast_data("int32_t", LittleEndian, tmp))
        self.assertEqual(True, Cmd.IsDone())

        # once again with verification
        Cmd.Execute()
        self.assertEqual(False, Cmd.IsDone(True))
        Port.Write(0x00ff, cast_data("int32_t", LittleEndian, tmp))
        self.assertEqual(True, Cmd.IsDone(True))

        # happy path (what to test on execution without verification?)
        Cmd.Execute(False)

        # execute function
        Cmd()
        # is executing?
        self.assertEqual(False, Cmd.IsDone())
        # manipulate the command register in order to simulate a self-resetting toggle
        tmp_data = Port.Read(0x00ff, sizeof("int32_t"))
        self.assertEqual(0x21430000,
                         cast_buffer("int32_t", LittleEndian, tmp_data))
        tmp = 0
        Port.Write(0x00ff, cast_data("int32_t", LittleEndian, tmp))
        self.assertEqual(True, Cmd.IsDone())

        # TestAccessMode
        self.assertEqual(RW, Cmd.GetAccessMode())

        #
        # Test the IValue interface
        #
        Value = Cmd
        strExec = "0"
        # function is done => value is "0"
        self.assertEqual(strExec, Value.ToString())
        # execute using a string
        strExec = "1"
        Value.FromString(strExec)
        # function is executing => value is "1"
        self.assertEqual(strExec, Value.ToString())
        self.assertTrue(None != Value.GetNode())

        # try to use an illegal string
        with self.assertRaises(InvalidArgumentException):
            Value.FromString("foo")

        Value.FromString("true")
Exemple #10
0
    def test_TestPort(self):
        # some basics
        # create and initialize a test port
        Port = CTestPort()
        MyRegister = 42
        Port.CreateEntry(0x0000, "uint32_t", 42, RW, LittleEndian)
        Port.CreateEntry(0x000f, "uint32_t", MyRegister, RW, LittleEndian)
        MyRegisterLittleEndian = MyRegister
        Port.CreateEntry(0x00ff, "uint32_t", MyRegisterLittleEndian, RW,
                         LittleEndian)

        # Test IPort::Read method
        Port = CTestPort()

        # write something to the register map
        MyRegister = 42
        Port.CreateEntry(0x00ff, "uint32_t", MyRegister, RO, LittleEndian)

        # check if it's there
        Buffer = Port.Read(0x00ff, sizeof("uint32_t"))
        self.assertEqual(MyRegister,
                         cast_buffer("uint32_t", LittleEndian, Buffer))

        # try to read from an invalid address
        with self.assertRaises(GenericException):
            Port.Read(0x0000, sizeof("uint32_t"))

        # try to read with invalid length
        with self.assertRaises(GenericException):
            Port.Read(0x00ff, 8)

        # Create an WO entry
        MyRegister = 43
        Port.CreateEntry(0x000f, "uint32_t", MyRegister, WO, LittleEndian)

        # try to read from a WO address
        with self.assertRaises(GenericException):
            Port.Read(0x000f, sizeof("uint32_t"))
        # Test IPort::Write method

        Port = CTestPort()

        # write something to the register map
        MyRegister = 0
        Port.CreateEntry(0x00ff, "uint32_t", MyRegister, RW, LittleEndian)

        # write at the location
        MyRegister = 42
        Port.Write(0x00ff, cast_data("uint32_t", LittleEndian, MyRegister))

        # read back
        Buffer = Port.Read(0x00ff, sizeof("uint32_t"))
        self.assertEqual(MyRegister,
                         cast_buffer("uint32_t", LittleEndian, Buffer))

        # try to write at an invalid address
        self.assertRaises(
            GenericException,
            Port.Write(0x0000, cast_data("uint32_t", LittleEndian,
                                         MyRegister)))

        # try to write with invalid length
        with self.assertRaises(GenericException):
            Port.Write(0x00ff, bytes(8))

        # make the entry RO
        MyRegister = 0
        Port.CreateEntry(0x000f, "uint32_t", MyRegister, RO, LittleEndian)

        # try to write to a RO address
        with self.assertRaises(GenericException):
            Port.Write(0x000f, cast_data("uint32_t", LittleEndian, MyRegister))
Exemple #11
0
    def test_ValueAccess(self):
        """[ GenApiTest@EnumerationTestSuite_TestValueAccess.xml|gxml
    
            <Enumeration Name="Enum">
                <EnumEntry Name="EnumValue1">
                    <Value>10</Value>
               </EnumEntry>
                <EnumEntry Name="EnumValue2">
                    <Value>20</Value>
               </EnumEntry>
                <pValue>Value</pValue>
            </Enumeration>
    
            <Integer Name="Value">
                <Value>10</Value>
            </Integer>
    
            <Enumeration Name="Enum2">
                <pIsLocked>Lock</pIsLocked>
                <EnumEntry Name="EnumValue1">
                    <Value>10</Value>
               </EnumEntry>
                <EnumEntry Name="EnumValue2">
                    <Value>20</Value>
               </EnumEntry>
                <EnumEntry Name="EnumValue3">
                    <pIsAvailable>False</pIsAvailable>
                    <Value>30</Value>
               </EnumEntry>
                <pValue>Value2</pValue>
            </Enumeration>
    
            <IntReg Name="Value2">
                <Address>0</Address>
                <Length>4</Length>
                <AccessMode>RW</AccessMode>
                <pPort>Port</pPort>
                <Sign>Signed</Sign>
                <Endianess>LittleEndian</Endianess>
            </IntReg>
    
            <Integer Name="False">
                <Value>0</Value>
            </Integer>
    
           <Integer Name="Lock">
               <Value>0</Value>
           </Integer>
    
            <Port Name="Port"/>
        """

        # LOG4CPP_NS::Category *pLogger = &CLog::GetLogger( "CppUnit.Performance" )

        Camera = CNodeMapRef()
        Camera._LoadXMLFromFile("GenApiTest", "EnumerationTestSuite_TestValueAccess")

        Enum = Camera.GetNode("Enum")
        self.assertEqual(intfIEnumeration, Enum.GetNode().GetPrincipalInterfaceType())

        Value = Camera.GetNode("Value")

        # happy path
        Enum.FromString("EnumValue1")
        self.assertEqual("EnumValue1", Enum.ToString())
        self.assertEqual(10, Value.GetValue())

        Enum.FromString("EnumValue2")
        self.assertEqual("EnumValue2", Enum.ToString())
        self.assertEqual(20, Value.GetValue())

        EnumEntry = Enum.GetCurrentEntry()
        print(EnumEntry)
        self.assertEqual("EnumValue2", EnumEntry.GetSymbolic())

        # Ahaem - this should not change over time :-)
        EnumEntry.GetNode().InvalidateNode()
        self.assertEqual(RO, EnumEntry.GetAccessMode())
        self.assertEqual(RO, EnumEntry.GetAccessMode())

        # value too small
        with self.assertRaises(InvalidArgumentException):   Enum.FromString("BlaBla")

        # GCLOGINFO( pLogger, "-------------------------------------------------")
        # GCLOGINFO( pLogger, "Setup : Enumeration <=> Integer")

        Value.GetNode().InvalidateNode()
        # TEST_BEGIN(1000)
        Enum.FromString("EnumValue1")
        # StopWatch.PauseBegin()
        Value.GetNode().InvalidateNode()
        # StopWatch.PauseEnd()
        # TEST_END( Enumeration::FromString )

        # now some tests with the other enum, connected to a real port
        Port = CTestPort()
        Port.CreateEntry(0x000, "int32_t", 10, RW, LittleEndian)
        Camera._Connect(Port, "Port")
        Enum2 = Camera.GetNode("Enum2")
        self.assertEqual(10, Enum2.GetIntValue())
        # modify the underlying value, not visible through the cache
        Value = 20
        Port.Write(0x00, cast_data("uint32_t", LittleEndian, Value))
        self.assertEqual(10, Enum2.GetIntValue())
        self.assertEqual("EnumValue1", Enum2.ToString())
        # but visible when bypassing the cache
        self.assertEqual(20, Enum2.GetIntValue(False, True))
        self.assertEqual("EnumValue2", Enum2.ToString(False, True))
        # now change it to point to the NA entry
        Value = 30
        Port.Write(0x00, cast_data("uint32_t", LittleEndian, Value))
        # and test without/with verification
        self.assertEqual(30, Enum2.GetIntValue(False, True))
        with self.assertRaises(AccessException):   Enum2.SetIntValue(30)
        self.assertEqual("EnumValue3", Enum2.ToString(False, True))
        with self.assertRaises(GenericException):
            Enum2.GetIntValue(True, True)
        with self.assertRaises(GenericException):
            Enum2.ToString(True, True)