Commit b43064d0 authored by Helga Velroyen's avatar Helga Velroyen
Browse files

Extend config by networks and networks by UUIDs



For network queries to work, we need to extend the general
config type to include all available networks. Additionally,
we add UUIDs to the network type itself.
Signed-off-by: default avatarHelga Velroyen <helgav@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 3673a326
......@@ -192,6 +192,7 @@ $(buildObject "Network" "network" $
, optionalField $
simpleField "ext_reservations" [t| String |]
]
++ uuidFields
++ serialFields
++ tagsFields)
......@@ -201,6 +202,9 @@ instance SerialNoObject Network where
instance TagsObject Network where
tagsOf = networkTags
instance UuidObject Network where
uuidOf = networkUuid
-- * NIC definitions
$(buildParam "Nic" "nicp"
......@@ -639,6 +643,7 @@ $(buildObject "ConfigData" "config" $
, simpleField "nodes" [t| Container Node |]
, simpleField "nodegroups" [t| Container NodeGroup |]
, simpleField "instances" [t| Container Instance |]
, simpleField "networks" [t| Container Network |]
]
++ serialFields)
......
......@@ -179,8 +179,9 @@ genValidNetwork = do
size <- genMaybe genJSValue
res <- liftM Just (genBitString $ netmask2NumHosts netmask)
ext_res <- liftM Just (genBitString $ netmask2NumHosts netmask)
uuid <- arbitrary
let n = Network name network_type mac_prefix net_family net net6 gateway
gateway6 size res ext_res 0 Set.empty
gateway6 size res ext_res uuid 0 Set.empty
return n
-- | Generates an arbitrary network type.
......@@ -215,11 +216,13 @@ genEmptyCluster ncount = do
show (map fst nodes'))
else GenericContainer nodemap
continsts = GenericContainer Map.empty
networks = GenericContainer Map.empty
grp <- arbitrary
let contgroups = GenericContainer $ Map.singleton guuid grp
serial <- arbitrary
cluster <- resize 8 arbitrary
let c = ConfigData version cluster contnodes contgroups continsts serial
let c = ConfigData version cluster contnodes contgroups continsts networks
serial
return c
-- * Test properties
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment