<s> from twisted . trial import unittest <EOL> from opennsa . topology import linkvector <EOL> ARUBA_PORT = '<STR_LIT>' <EOL> BONAIRE_PORT = '<STR_LIT>' <EOL> CURACAO_PORT = '<STR_LIT>' <EOL> DOMINICA_PORT = '<STR_LIT>' <EOL> LOCAL_TOPO = '<STR_LIT>' <EOL> ARUBA_TOPO = '<STR_LIT>' <EOL> BONAIRE_TOPO = '<STR_LIT>' <EOL> CURACAO_TOPO = '<STR_LIT>' <EOL> DOMINCA_TOPO = '<STR_LIT>' <EOL> class LinkVectorTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . rv = linkvector . LinkVector ( [ LOCAL_TOPO ] ) <EOL> def testBasicPathfindingVector ( self ) : <EOL> self . rv . updateVector ( ARUBA_PORT , { ARUBA_TOPO : <NUM_LIT:1> , BONAIRE_TOPO : <NUM_LIT:2> , CURACAO_TOPO : <NUM_LIT:3> } ) <EOL> self . failUnlessEqual ( self . rv . vector ( ARUBA_TOPO ) , ARUBA_PORT ) <EOL> self . failUnlessEqual ( self . rv . vector ( BONAIRE_TOPO ) , ARUBA_PORT ) <EOL> self . failUnlessEqual ( self . rv . vector ( CURACAO_TOPO ) , ARUBA_PORT ) <EOL> self . failUnlessEquals ( self . rv . listVectors ( ) , { ARUBA_TOPO : <NUM_LIT:1> , BONAIRE_TOPO : <NUM_LIT:2> , CURACAO_TOPO : <NUM_LIT:3> } ) <EOL> self . rv . updateVector ( BONAIRE_PORT , { BONAIRE_TOPO : <NUM_LIT:1> , CURACAO_TOPO : <NUM_LIT:2> } ) <EOL> self . failUnlessEqual ( self . rv . vector ( ARUBA_TOPO ) , ARUBA_PORT ) <EOL> self . failUnlessEqual ( self . rv . vector ( BONAIRE_TOPO ) , BONAIRE_PORT ) <EOL> self . failUnlessEqual ( self . rv . vector ( CURACAO_TOPO ) , BONAIRE_PORT ) <EOL> self . failUnlessEquals ( self . rv . listVectors ( ) , { ARUBA_TOPO : <NUM_LIT:1> , BONAIRE_TOPO : <NUM_LIT:1> , CURACAO_TOPO : <NUM_LIT:2> } ) <EOL> def testLocalNetworkExclusion ( self ) : <EOL> self . rv = linkvector . LinkVector ( [ BONAIRE_TOPO ] ) <EOL> self . rv . updateVector ( ARUBA_PORT , { ARUBA_TOPO : <NUM_LIT:1> , BONAIRE_TOPO : <NUM_LIT:1> , CURACAO_TOPO : <NUM_LIT:2> } ) <EOL> self . failUnlessEqual ( self . rv . vector ( ARUBA_TOPO ) , ARUBA_PORT ) <EOL> self . failUnlessEqual ( self . rv . vector ( BONAIRE_TOPO ) , None ) <EOL> self . failUnlessEqual ( self . rv . vector ( CURACAO_TOPO ) , ARUBA_PORT ) <EOL> def testBlackList ( self ) : <EOL> self . rv = linkvector . LinkVector ( [ BONAIRE_TOPO ] , blacklist_networks = [ CURACAO_TOPO ] ) <EOL> self . rv . updateVector ( ARUBA_PORT , { ARUBA_TOPO : <NUM_LIT:1> , BONAIRE_TOPO : <NUM_LIT:1> , CURACAO_TOPO : <NUM_LIT:2> } ) <EOL> self . failUnlessEqual ( self . rv . vector ( ARUBA_TOPO ) , ARUBA_PORT ) <EOL> self . failUnlessEqual ( self . rv . vector ( BONAIRE_TOPO ) , None ) <EOL> self . failUnlessEqual ( self . rv . vector ( CURACAO_TOPO ) , None ) <EOL> def testMaxCost ( self ) : <EOL> self . rv = linkvector . LinkVector ( [ BONAIRE_TOPO ] , max_cost = <NUM_LIT:3> ) <EOL> self . rv . updateVector ( ARUBA_PORT , { ARUBA_TOPO : <NUM_LIT:1> , BONAIRE_TOPO : <NUM_LIT:1> , CURACAO_TOPO : <NUM_LIT:4> } ) <EOL> self . failUnlessEqual ( self . rv . vector ( ARUBA_TOPO ) , ARUBA_PORT ) <EOL> self . failUnlessEqual ( self . rv . vector ( BONAIRE_TOPO ) , None ) <EOL> self . failUnlessEqual ( self . rv . vector ( CURACAO_TOPO ) , None ) </s>
