FYI pushing with the following interdiff:
diff --git a/test/hs/Test/Ganeti/Objects.hs b/test/hs/Test/Ganeti/Objects.hs
index def5263..65d7659 100644
--- a/test/hs/Test/Ganeti/Objects.hs
+++ b/test/hs/Test/Ganeti/Objects.hs
@@ -44,7 +44,6 @@ import qualified Data.Map as Map
import qualified Data.Set as Set
import qualified Text.JSON as J
-import Test.Ganeti.Query.Language (genJSValue)
import Test.Ganeti.TestHelper
import Test.Ganeti.TestCommon
import Test.Ganeti.Types ()
@@ -169,16 +168,14 @@ genValidNetwork = do
netmask <- choose (24::Int, 30)
name <- genName >>= mkNonEmpty
mac_prefix <- genMaybe genName
- net_family <- arbitrary
net <- genIp4NetWithNetmask netmask
net6 <- genMaybe genIp6Net
gateway <- genMaybe genIp4AddrStr
gateway6 <- genMaybe genIp6Addr
- size <- genMaybe genJSValue
res <- liftM Just (genBitString $ netmask2NumHosts netmask)
ext_res <- liftM Just (genBitString $ netmask2NumHosts netmask)
- let n = Network name network_type mac_prefix net_family net net6 gateway
- gateway6 size res ext_res 0 Set.empty
+ let n = Network name mac_prefix net net6 gateway
+ gateway6 res ext_res 0 Set.empty
return n
-- | Generate an arbitrary string consisting of '0' and '1' of the
given length.
diff --git a/test/hs/Test/Ganeti/OpCodes.hs b/test/hs/Test/Ganeti/OpCodes.hs
index 5092ffd..caad259 100644
--- a/test/hs/Test/Ganeti/OpCodes.hs
+++ b/test/hs/Test/Ganeti/OpCodes.hs
@@ -318,14 +318,14 @@ instance Arbitrary OpCodes.OpCode where
OpCodes.OpTestDummy <$> pure J.JSNull <*> pure J.JSNull <*>
pure J.JSNull <*> pure J.JSNull
"OP_NETWORK_ADD" ->
- OpCodes.OpNetworkAdd <$> genNameNE <*> arbitrary <*> genIp4Net <*>
+ OpCodes.OpNetworkAdd <$> genNameNE <*> genIp4Net <*>
genMaybe genIp4Addr <*> pure Nothing <*> pure Nothing <*>
genMaybe genMacPrefix <*> genMaybe (listOf genIp4Addr) <*>
arbitrary <*> (genTags >>= mapM mkNonEmpty)
"OP_NETWORK_REMOVE" ->
OpCodes.OpNetworkRemove <$> genNameNE <*> arbitrary
"OP_NETWORK_SET_PARAMS" ->
- OpCodes.OpNetworkSetParams <$> genNameNE <*> arbitrary <*>
+ OpCodes.OpNetworkSetParams <$> genNameNE <*>
genMaybe genIp4Addr <*> pure Nothing <*> pure Nothing <*>
genMaybe genMacPrefix <*> genMaybe (listOf genIp4Addr) <*>
genMaybe (listOf genIp4Addr)
Thanks,
Guido
On Mon, Feb 11, 2013 at 3:14 PM, Guido Trotter <[email protected]> wrote:
> LGTM
>
> (squashing into the previous patch)
>
> Thanks,
> Guido
>
>
> On Mon, Feb 11, 2013 at 1:42 PM, Dimitris Aragiorgis <[email protected]> wrote:
>> See corresponding patch for python.
>>
>> Signed-off-by: Dimitris Aragiorgis <[email protected]>
>> ---
>> src/Ganeti/Objects.hs | 2 --
>> src/Ganeti/OpCodes.hs | 2 --
>> src/Ganeti/OpParams.hs | 5 -----
>> src/Ganeti/Types.hs | 9 ---------
>> test/hs/Test/Ganeti/Network.hs | 2 --
>> test/hs/Test/Ganeti/Objects.hs | 6 ------
>> test/hs/Test/Ganeti/Types.hs | 15 ---------------
>> 7 files changed, 41 deletions(-)
>>
>> diff --git a/src/Ganeti/Objects.hs b/src/Ganeti/Objects.hs
>> index b0fd163..d3f13df 100644
>> --- a/src/Ganeti/Objects.hs
>> +++ b/src/Ganeti/Objects.hs
>> @@ -173,8 +173,6 @@ roleDescription NRMaster = "master"
>> $(buildObject "Network" "network" $
>> [ simpleField "name" [t| NonEmptyString |]
>> , optionalField $
>> - simpleField "network_type" [t| NetworkType |]
>> - , optionalField $
>> simpleField "mac_prefix" [t| String |]
>> , optionalField $
>> simpleField "family" [t| Int |]
>> diff --git a/src/Ganeti/OpCodes.hs b/src/Ganeti/OpCodes.hs
>> index ec9a34f..7e931b8 100644
>> --- a/src/Ganeti/OpCodes.hs
>> +++ b/src/Ganeti/OpCodes.hs
>> @@ -501,7 +501,6 @@ $(genOpCode "OpCode"
>> ])
>> , ("OpNetworkAdd",
>> [ pNetworkName
>> - , pNetworkType
>> , pNetworkAddress4
>> , pNetworkGateway4
>> , pNetworkAddress6
>> @@ -517,7 +516,6 @@ $(genOpCode "OpCode"
>> ])
>> , ("OpNetworkSetParams",
>> [ pNetworkName
>> - , pNetworkType
>> , pNetworkGateway4
>> , pNetworkAddress6
>> , pNetworkGateway6
>> diff --git a/src/Ganeti/OpParams.hs b/src/Ganeti/OpParams.hs
>> index b247f00..8e91b8f 100644
>> --- a/src/Ganeti/OpParams.hs
>> +++ b/src/Ganeti/OpParams.hs
>> @@ -222,7 +222,6 @@ module Ganeti.OpParams
>> , pTestDummyFail
>> , pTestDummySubmitJobs
>> , pNetworkName
>> - , pNetworkType
>> , pNetworkAddress4
>> , pNetworkGateway4
>> , pNetworkAddress6
>> @@ -1358,10 +1357,6 @@ pTestDummySubmitJobs =
>> pNetworkName :: Field
>> pNetworkName = simpleField "network_name" [t| NonEmptyString |]
>>
>> --- | Network type field.
>> -pNetworkType :: Field
>> -pNetworkType = optionalField $ simpleField "network_type" [t| NetworkType |]
>> -
>> -- | Network address (IPv4 subnet). FIXME: no real type for this.
>> pNetworkAddress4 :: Field
>> pNetworkAddress4 =
>> diff --git a/src/Ganeti/Types.hs b/src/Ganeti/Types.hs
>> index ae692f6..e6c9378 100644
>> --- a/src/Ganeti/Types.hs
>> +++ b/src/Ganeti/Types.hs
>> @@ -70,8 +70,6 @@ module Ganeti.Types
>> , IAllocatorTestDir(..)
>> , IAllocatorMode(..)
>> , iAllocatorModeToRaw
>> - , NetworkType(..)
>> - , networkTypeToRaw
>> , NICMode(..)
>> , nICModeToRaw
>> , JobStatus(..)
>> @@ -359,13 +357,6 @@ $(THH.declareSADT "IAllocatorMode"
>> ])
>> $(THH.makeJSONInstance ''IAllocatorMode)
>>
>> --- | Network type.
>> -$(THH.declareSADT "NetworkType"
>> - [ ("PrivateNetwork", 'C.networkTypePrivate)
>> - , ("PublicNetwork", 'C.networkTypePublic)
>> - ])
>> -$(THH.makeJSONInstance ''NetworkType)
>> -
>> -- | Netork mode.
>> $(THH.declareSADT "NICMode"
>> [ ("NMBridged", 'C.nicModeBridged)
>> diff --git a/test/hs/Test/Ganeti/Network.hs b/test/hs/Test/Ganeti/Network.hs
>> index 4867830..57793ca 100644
>> --- a/test/hs/Test/Ganeti/Network.hs
>> +++ b/test/hs/Test/Ganeti/Network.hs
>> @@ -4,7 +4,6 @@
>> module Test.Ganeti.Network
>> ( testNetwork
>> , genBitStringMaxLen
>> - , genNetworkType
>> ) where
>>
>> import Test.QuickCheck
>> @@ -14,7 +13,6 @@ import Ganeti.Objects as Objects
>>
>> import Test.Ganeti.Objects
>> ( genBitStringMaxLen
>> - , genNetworkType
>> , genValidNetwork )
>> import Test.Ganeti.TestHelper
>> import Test.Ganeti.TestCommon
>> diff --git a/test/hs/Test/Ganeti/Objects.hs b/test/hs/Test/Ganeti/Objects.hs
>> index a4fa648..def5263 100644
>> --- a/test/hs/Test/Ganeti/Objects.hs
>> +++ b/test/hs/Test/Ganeti/Objects.hs
>> @@ -31,7 +31,6 @@ module Test.Ganeti.Objects
>> , Node(..)
>> , genEmptyCluster
>> , genValidNetwork
>> - , genNetworkType
>> , genBitStringMaxLen
>> ) where
>>
>> @@ -169,7 +168,6 @@ genValidNetwork = do
>> -- generate netmask for the IPv4 network
>> netmask <- choose (24::Int, 30)
>> name <- genName >>= mkNonEmpty
>> - network_type <- genMaybe genNetworkType
>> mac_prefix <- genMaybe genName
>> net_family <- arbitrary
>> net <- genIp4NetWithNetmask netmask
>> @@ -183,10 +181,6 @@ genValidNetwork = do
>> gateway6 size res ext_res 0 Set.empty
>> return n
>>
>> --- | Generates an arbitrary network type.
>> -genNetworkType :: Gen NetworkType
>> -genNetworkType = elements [ PrivateNetwork, PublicNetwork ]
>> -
>> -- | Generate an arbitrary string consisting of '0' and '1' of the given
>> length.
>> genBitString :: Int -> Gen String
>> genBitString len = vectorOf len (elements "01")
>> diff --git a/test/hs/Test/Ganeti/Types.hs b/test/hs/Test/Ganeti/Types.hs
>> index 7526e01..6f84782 100644
>> --- a/test/hs/Test/Ganeti/Types.hs
>> +++ b/test/hs/Test/Ganeti/Types.hs
>> @@ -112,8 +112,6 @@ $(genArbitrary ''IAllocatorTestDir)
>>
>> $(genArbitrary ''IAllocatorMode)
>>
>> -$(genArbitrary ''NetworkType)
>> -
>> $(genArbitrary ''NICMode)
>>
>> $(genArbitrary ''JobStatus)
>> @@ -287,17 +285,6 @@ case_IAllocatorMode_pyequiv = do
>> all_hs_codes = sort $ map Types.iAllocatorModeToRaw
>> [minBound..maxBound]
>> assertEqual "for IAllocatorMode equivalence" all_py_codes all_hs_codes
>>
>> --- | Test 'NetworkType' serialisation.
>> -prop_NetworkType_serialisation :: NetworkType -> Property
>> -prop_NetworkType_serialisation = testSerialisation
>> -
>> --- | Tests equivalence with Python, based on Constants.hs code.
>> -case_NetworkType_pyequiv :: Assertion
>> -case_NetworkType_pyequiv = do
>> - let all_py_codes = sort C.networkValidTypes
>> - all_hs_codes = sort $ map Types.networkTypeToRaw [minBound..maxBound]
>> - assertEqual "for NetworkType equivalence" all_py_codes all_hs_codes
>> -
>> -- | Test 'NICMode' serialisation.
>> prop_NICMode_serialisation :: NICMode -> Property
>> prop_NICMode_serialisation = testSerialisation
>> @@ -417,8 +404,6 @@ testSuite "Types"
>> , 'prop_IAllocatorTestDir_serialisation
>> , 'prop_IAllocatorMode_serialisation
>> , 'case_IAllocatorMode_pyequiv
>> - , 'prop_NetworkType_serialisation
>> - , 'case_NetworkType_pyequiv
>> , 'prop_NICMode_serialisation
>> , 'prop_OpStatus_serialization
>> , 'prop_JobStatus_serialization
>> --
>> 1.7.10.4
>>
>
>
>
> --
> Guido Trotter
> Ganeti engineering
> Google Germany
--
Guido Trotter
Ganeti engineering
Google Germany