Commit f25c0147 authored by berge's avatar berge
Browse files

implemented f_acUpdateInterfaces

parent 57cea8c1
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -939,7 +939,7 @@ module LibItsGeoNetworking_Functions {
         * @param p_event The event to trigger
         * @param p_event The event to trigger
         * @return
         * @return
         */
         */
        function f_acTriggerEvent(template (value) AcGNEvent p_event) runs on ItsAdapterComponent return FncRetCode {
        function f_acTriggerEvent(template (value) AcGnPrimitive p_event) runs on ItsAdapterComponent return FncRetCode {
            var FncRetCode v_ret := e_success;
            var FncRetCode v_ret := e_success;
            
            
            acPort.send(p_event);
            acPort.send(p_event);
@@ -953,7 +953,7 @@ module LibItsGeoNetworking_Functions {
         * @return
         * @return
         */
         */
        function f_acGetLongPosVector(GN_Address p_gnAddress) runs on ItsAdapterComponent return LongPosVector {
        function f_acGetLongPosVector(GN_Address p_gnAddress) runs on ItsAdapterComponent return LongPosVector {
            var AcGNResult v_result;
            var AcGnResponse v_result;
            
            
            f_acTriggerEvent(m_getLongPosVector(p_gnAddress));
            f_acTriggerEvent(m_getLongPosVector(p_gnAddress));
            tc_ac.start;
            tc_ac.start;
+8 −8
Original line number Original line Diff line number Diff line
@@ -225,7 +225,7 @@ module LibItsGeoNetworking_Templates {
             * @desc Testsystem will start beaconing for the given neighbor
             * @desc Testsystem will start beaconing for the given neighbor
             * @param p_beaconHeader The neighbor information
             * @param p_beaconHeader The neighbor information
             */
             */
            template (value) AcGNEvent m_startBeaconing(
            template (value) AcGnPrimitive m_startBeaconing(
                template (value) BeaconHeader p_beaconHeader
                template (value) BeaconHeader p_beaconHeader
            ) := {
            ) := {
                startBeaconing := {
                startBeaconing := {
@@ -237,7 +237,7 @@ module LibItsGeoNetworking_Templates {
             * @desc Testsystem will stop beaconing for the given neighbor
             * @desc Testsystem will stop beaconing for the given neighbor
             * @param p_compName The neighbor
             * @param p_compName The neighbor
             */
             */
            template AcGNEvent m_stopBeaconing := {
            template AcGnPrimitive m_stopBeaconing := {
                stopBeaconing:= {
                stopBeaconing:= {
                }
                }
            }
            }
@@ -246,7 +246,7 @@ module LibItsGeoNetworking_Templates {
             * @desc Testsystem will pass received to the TTCN-3
             * @desc Testsystem will pass received to the TTCN-3
             * @param p_beaconHeader The neighbor information
             * @param p_beaconHeader The neighbor information
             */
             */
            template AcGNEvent m_startPassBeaconing(
            template AcGnPrimitive m_startPassBeaconing(
                template (value) BeaconHeader p_beaconHeader
                template (value) BeaconHeader p_beaconHeader
            ) := {
            ) := {
                startPassBeaconing := {
                startPassBeaconing := {
@@ -257,7 +257,7 @@ module LibItsGeoNetworking_Templates {
            /**
            /**
             * @desc Testsystem will stop passing beacon information to the TTCN-3
             * @desc Testsystem will stop passing beacon information to the TTCN-3
             */
             */
            template AcGNEvent m_stopPassBeaconing := {
            template AcGnPrimitive m_stopPassBeaconing := {
                stopPassBeaconing := {
                stopPassBeaconing := {
                }
                }
            }
            }
@@ -266,7 +266,7 @@ module LibItsGeoNetworking_Templates {
             * @desc Testsystem will start beaconing for the given neighbor
             * @desc Testsystem will start beaconing for the given neighbor
             * @param p_beaconHeader The neighbor information
             * @param p_beaconHeader The neighbor information
             */
             */
            template (value) AcGNEvent m_startBeaconingMultipleNeighbour(
            template (value) AcGnPrimitive m_startBeaconingMultipleNeighbour(
                template (value) BeaconHeader p_beaconHeader,
                template (value) BeaconHeader p_beaconHeader,
                integer p_numberOfNeighbour
                integer p_numberOfNeighbour
            ) := {
            ) := {
@@ -280,7 +280,7 @@ module LibItsGeoNetworking_Templates {
             * @desc Testsystem will stop beaconing for the given neighbor
             * @desc Testsystem will stop beaconing for the given neighbor
             * @param p_compName The neighbor
             * @param p_compName The neighbor
             */
             */
            template AcGNEvent m_stopBeaconingMultipleNeighbour := {
            template AcGnPrimitive m_stopBeaconingMultipleNeighbour := {
                stopBeaconingMultipleNeighbour:= {
                stopBeaconingMultipleNeighbour:= {
                }
                }
            }            
            }            
@@ -290,7 +290,7 @@ module LibItsGeoNetworking_Templates {
             *       found in received beacon information to the TTCN-3
             *       found in received beacon information to the TTCN-3
             * @param p_gnAddress The GN address included in the LongPosVector
             * @param p_gnAddress The GN address included in the LongPosVector
             */
             */
            template AcGNEvent m_getLongPosVector(GN_Address p_gnAddress) := {
            template AcGnPrimitive m_getLongPosVector(GN_Address p_gnAddress) := {
                getLongPosVector := {
                getLongPosVector := {
                    gnAddress := p_gnAddress
                    gnAddress := p_gnAddress
                }
                }
@@ -300,7 +300,7 @@ module LibItsGeoNetworking_Templates {
             * @desc    Receive template adapter control result for long position vector with specific GN_Address
             * @desc    Receive template adapter control result for long position vector with specific GN_Address
             * @param   p_gnAddress GN_Address to be contained in the long position vector
             * @param   p_gnAddress GN_Address to be contained in the long position vector
             */
             */
            template AcGNResult mw_getLongPosVectorAny(template (present) GN_Address p_gnAddress) := {
            template AcGnResponse mw_getLongPosVectorAny(template (present) GN_Address p_gnAddress) := {
                getLongPosVector := mw_longPosVectorAny(p_gnAddress)
                getLongPosVector := mw_longPosVectorAny(p_gnAddress)
            }
            }
        
        
+4 −4
Original line number Original line Diff line number Diff line
@@ -883,17 +883,17 @@ module LibItsGeoNetworking_TypesAndValues {


    group acPrimitives {
    group acPrimitives {
        
        
        type union AcGNEvent {
        type union AcGnPrimitive {
            AcStartBeaconing startBeaconing,
            AcStartBeaconing startBeaconing,
            AcStopBeaconing stopBeaconing,
            AcStopBeaconing stopBeaconing,
            AcStartPassBeaconing startPassBeaconing,
            AcStartPassBeaconing startPassBeaconing,
            AcStopPassBeaconing stopPassBeaconing,
            AcStopPassBeaconing stopPassBeaconing,
            AcStartBeaconingMultipleNeighbour startBeaconingMultipleNeighbour,
            AcStartBeaconingMultipleNeighbour startBeaconingMultipleNeighbour,
            AcStopBeaconingMultipleNeighbour stopBeaconingMultipleNeighbour,
            AcStopBeaconingMultipleNeighbour stopBeaconingMultipleNeighbour,
            TaGetLongPosVector getLongPosVector
            AcGetLongPosVector getLongPosVector
        }
        }
        
        
        type union AcGNResult {
        type union AcGnResponse {
            LongPosVector getLongPosVector
            LongPosVector getLongPosVector
        }
        }
        
        
@@ -919,7 +919,7 @@ module LibItsGeoNetworking_TypesAndValues {
        type record AcStopBeaconingMultipleNeighbour {
        type record AcStopBeaconingMultipleNeighbour {
        }
        }
        
        
        type record TaGetLongPosVector {
        type record AcGetLongPosVector {
            GN_Address gnAddress
            GN_Address gnAddress
        }
        }
        
        
+147 −11
Original line number Original line Diff line number Diff line
@@ -11,6 +11,7 @@ module LibItsIpv6OverGeoNetworking_Functions {
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
    import from LibCommon_DataStrings all;
    import from LibCommon_VerdictControl all;
    import from LibCommon_VerdictControl all;
    import from LibCommon_Sync all;
    
    
    // LibIts
    // LibIts
    import from LibIts_TestSystem all;
    import from LibIts_TestSystem all;
@@ -20,6 +21,7 @@ module LibItsIpv6OverGeoNetworking_Functions {
    import from LibItsGeoNetworking_Templates all;
    import from LibItsGeoNetworking_Templates all;
    import from LibItsIpv6OverGeoNetworking_TypesAndValues all;
    import from LibItsIpv6OverGeoNetworking_TypesAndValues all;
    import from LibItsIpv6OverGeoNetworking_Templates all;
    import from LibItsIpv6OverGeoNetworking_Templates all;
    import from LibItsIpv6OverGeoNetworking_Pixits all;
    
    
    group ipv6OverGeoConfigurationFunctions {
    group ipv6OverGeoConfigurationFunctions {
        
        
@@ -34,16 +36,33 @@ module LibItsIpv6OverGeoNetworking_Functions {
        function f_ipv6_cf01Up() runs on ItsNt {
        function f_ipv6_cf01Up() runs on ItsNt {


            // Variables
            // Variables
            var float v_distance;
            
            
            // Map
            // Map
            map(self:ipv6OverGeoNetworkingPort, system:ipv6OverGeoNetworkingPort);
            map(self:ipv6OverGeoNetworkingPort, system:ipv6OverGeoNetworkingPort);
            
            
            f_cf01Up();
            f_cf01Up();
            v_distance := f_distance(f_getPosition(c_compNodeB), f_getPosition(c_compIut));
            
            
            // Compute IPv6 addresses
            f_addAddresses(vc_addressTable, c_compIut);
            f_addAddresses(vc_addressTable, c_compIut);
            f_addAddresses(vc_addressTable, c_compNodeA);
            f_addAddresses(vc_addressTable, c_compNodeA);
            f_addAddresses(vc_addressTable, c_compNodeB);
            f_addAddresses(vc_addressTable, c_compNodeB);
            
            
            // Create additional areas
            f_addArea(vc_areaTable, c_gvlArea1, 
                f_computeSquareArea(f_getPosition(c_compIut), float2int(2.1 * v_distance)));
            f_addArea(vc_areaTable, c_gvlArea2, 
                f_computeSquareArea(f_getPosition(c_compIut), float2int(2.2 * v_distance)));
            f_addArea(vc_areaTable, c_gvlArea3, 
                f_computeSquareArea(f_getPosition(c_compIut), float2int(2.3 * v_distance)));
            
            // Create GVLs
            f_addGvl(c_automaticGvl1, f_getPrefix(1), f_getPrefixLength(1), c_gvlArea1, "");
            f_addGvl(c_automaticGvl2, f_getPrefix(2), f_getPrefixLength(2), c_gvlArea2, "");
            f_addGvl(c_automaticGvl3, f_getPrefix(3), f_getPrefixLength(3), c_gvlArea3, "");
            
            
        } // end f_cf01Up
        } // end f_cf01Up


        /**
        /**
@@ -62,10 +81,49 @@ module LibItsIpv6OverGeoNetworking_Functions {
    
    
    group testAdapter {
    group testAdapter {
        
        
        function f_acUpdateInterfaces() {
        function f_acUpdateInterfaces() runs on ItsNt {
            
                        
            //TODO
            var AcGn6Response v_response;
            // + vc_tvlInterface
            var AcGn6InterfaceInfoList v_interfaceInfoList;
            var integer i, j, k;
            
            acPort.send(m_acGetInterfaceInfos);
            tc_ac.start;
            alt {
                [] acPort.receive(mw_acInterfaceInfos) -> value v_response {
                    tc_ac.stop;
                    
                    v_interfaceInfoList := valueof(v_response.interfaceInfoList);
                    // Go through interfaceInfos
                    for(i:=0; i < sizeof(v_interfaceInfoList); i:=i+1) {
                        // Go through IPv6 addresses configured for this interface
                        for(j:=0; j < sizeof(v_interfaceInfoList[i].ipv6AddressList); j:=j+1) {
                            // Compare IPv6 address to recorded GVL prefixes
                            for(k:=0; k < sizeof(vc_gvlTable); k:=k+1) {
                                if(f_isIpv6AddressCorrespondingToPrefix(
                                    v_interfaceInfoList[i].ipv6AddressList[j], 
                                    vc_gvlTable[k].prefix, 
                                    vc_gvlTable[k].prefixLength)) {
                                    // interface i is associated to GVL k
                                    vc_gvlTable[k].interface := v_interfaceInfoList[i].interfaceName;
                                    break;    
                                }
                            }
                            if(k >= sizeof(vc_gvlTable)) {
                                // GVL already found
                                break;
                            }
                        }   
                    }    
                }
                [] acPort.receive {
                    tc_ac.stop;
                    f_selfOrClientSyncAndVerdict("error", e_timeout, "*** f_acUpdateInterfaces: Received unexpected message ***");
                }
                [] tc_ac.timeout {
                    f_selfOrClientSyncAndVerdict("error", e_timeout, "*** f_acUpdateInterfaces: Timeout while waiting for adapter control event result ***");
                }
            }            
        }
        }
        
        
    } // end group testAdapter
    } // end group testAdapter
@@ -115,20 +173,46 @@ module LibItsIpv6OverGeoNetworking_Functions {
    
    
    group miscellaneous {
    group miscellaneous {
        
        
        function f_addGvl(
            in charstring p_gvlKey,
            in Oct16 p_prefix,
            in UInt8 p_prefixLength,
            in charstring p_area,
            in charstring p_interface
        ) runs on ItsNt {
            vc_gvlTable[lengthof(vc_gvlTable)] := {
                key := p_gvlKey,
                prefix := p_prefix,
                prefixLength := p_prefixLength,
                area := p_area,
                interface := p_interface
            };
        } // end f_addGvl
        
        /**
        /**
         * @desc Gets the Geographical Virtual link entry associated to an area
         * @desc Gets the Geographical Virtual link entry associated to an area
         * @param p_areaIndex The index of the area
         * @param p_areaIndex The index of the area
         */
         */
        function f_getGVL(in integer p_areaIndex) runs on ItsNt return GvlTableEntry {
        function f_getGvl(in charstring p_gvlName) runs on ItsNt return GvlTableEntry {
            return valueof(vc_gvlTable[p_areaIndex]);
            var GvlTableEntry v_return;
        } // end f_getGVL
            var integer i := 0;
            
            for (i:=0; i<lengthof(vc_gvlTable); i:=i+1) {
                if (vc_gvlTable[i].key == p_gvlName) {
                    v_return := valueof(vc_gvlTable[i]);
                }
            }
            
            return v_return;
            
        } // end f_getGvl
                
                
        function f_getGvlInterface(in integer p_areaIndex) runs on ItsNt return charstring {
        function f_getGvlInterface(in charstring p_gvlName) runs on ItsNt return charstring {
            return f_getGVL(p_areaIndex).interface   
            return f_getGvl(p_gvlName).interface   
        } // end f_getGvlInterface
        } // end f_getGvlInterface
        
        
        function f_getTvlInterface() runs on ItsNt return charstring {
        function f_getTvlInterface() runs on ItsNt return charstring {
            return valueof(vc_tvlInterface); 
            return PX_GN6_TVL_INTERFACE_NAME; 
        } // end f_getTvlInterface
        } // end f_getTvlInterface
        
        
        /**
        /**
@@ -313,6 +397,58 @@ module LibItsIpv6OverGeoNetworking_Functions {
            return v_trafficClass;
            return v_trafficClass;
        } // end f_getTrafficClassFromPriority
        } // end f_getTrafficClassFromPriority
        
        
        function f_getPrefix(in integer p_index) return Oct16 {
        
            select (p_index) {
                case (1) {
                    return PX_GN6_PREFIX_1;
                }
                case (2) {
                    return PX_GN6_PREFIX_2;
                }
                case (3) {
                    return PX_GN6_PREFIX_3;
                }
            }
            
            return int2oct(0, 16);
            
        } // end f_getPrefix

        function f_getPrefixLength(in integer p_index) return UInt8 {

            select (p_index) {
                case (1) {
                    return PX_GN6_PREFIX_LENGTH_1;
                }
                case (2) {
                    return PX_GN6_PREFIX_LENGTH_2;
                }
                case (3) {
                    return PX_GN6_PREFIX_LENGTH_3;
                }
            }
            
            return 64;
            
        } // end f_getPrefixLength
        
        function f_isIpv6AddressCorrespondingToPrefix(Ipv6Address p_ipv6Address, Ipv6Address p_prefix, UInt8 p_prefixLength) 
        return boolean {
            
            var bitstring v_ipv6Address := oct2bit(p_ipv6Address);
            var bitstring v_prefix := oct2bit(p_prefix);
            var integer i;
            
            for(i:=0; i < p_prefixLength; i:=i+1) {
                if(v_ipv6Address[i] != v_prefix[i]) {
                    return false;
                }   
            }
            
            return true;
        } // end f_isIpv6AddressCorrespondingToPrefix
    
    } // end group miscellaneous
    } // end group miscellaneous


} // end LibItsIpv6OverGeoNetworking_Functions
} // end LibItsIpv6OverGeoNetworking_Functions
 No newline at end of file
+42 −0
Original line number Original line Diff line number Diff line
@@ -7,9 +7,51 @@
 */
 */
module LibItsIpv6OverGeoNetworking_Pixits {
module LibItsIpv6OverGeoNetworking_Pixits {
    
    
    // LibCommon
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
    
    /**
    /**
     * @desc Time for building the configuration and virtual interfaces dynamically.
     * @desc Time for building the configuration and virtual interfaces dynamically.
     */
     */
    modulepar float PX_T_BUILD_CONFIG := 5.0;
    modulepar float PX_T_BUILD_CONFIG := 5.0;
 
 
    /**
     * @desc IPv6 prefix 1 to be used for defining GVL
     */
    modulepar Oct16 PX_GN6_PREFIX_1 := '3FFE0000000000010000000000000000'O;

    /**
     * @desc IPv6 prefix 2 to be used for defining GVL
     */
    modulepar Oct16 PX_GN6_PREFIX_2 := '3FFE0000000000020000000000000000'O;

    /**
     * @desc IPv6 prefix 3 to be used for defining GVL
     */
    modulepar Oct16 PX_GN6_PREFIX_3 := '3FFE0000000000030000000000000000'O;   
    
    /**
     * @desc Length of IPv6 prefix 1
     * @see  PX_GN6_PREFIX_1
     */
    modulepar UInt8 PX_GN6_PREFIX_LENGTH_1 := 64;

    /**
     * @desc Length of IPv6 prefix 1
     * @see  PX_GN6_PREFIX_2
     */
    modulepar UInt8 PX_GN6_PREFIX_LENGTH_2 := 64;

    /**
     * @desc Length of IPv6 prefix 3
     * @see  PX_GN6_PREFIX_3
     */
    modulepar UInt8 PX_GN6_PREFIX_LENGTH_3 := 64;

    /**
     * @desc Name of IUT's virtual interface associated with TVL
     */
    modulepar charstring PX_GN6_TVL_INTERFACE_NAME := "tvl0";   
         
}
}
 No newline at end of file
Loading