Repository: threefoldtech/zos
Pull request #625 (2020-03-25 16:20:33)

Type cleanup
To review this PR please follow this order:
- Review the client code (all new) under tools/client 
- Gedis types and commands has been dropped (probably commands will be reintroduced later again, but under client)
- Check changes in daemons to use the new client instead of the scattered sotres
- Type converts has been changed to use types from mock



Patch:
diff --git a/cmds/capacityd/main.go b/cmds/capacityd/main.go
index a1dfbd3b..99cbd538 100644
--- a/cmds/capacityd/main.go
+++ b/cmds/capacityd/main.go
@@ -14,6 +14,8 @@ import (
 	"github.com/threefoldtech/zos/pkg/monitord"
 	"github.com/threefoldtech/zos/pkg/stubs"
 	"github.com/threefoldtech/zos/pkg/utils"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/directory"
+	"github.com/threefoldtech/zos/tools/client"
 
 	"github.com/rs/zerolog/log"
 
@@ -26,7 +28,7 @@ const module = "monitor"
 func cap(ctx context.Context, client zbus.Client) {
 	storage := stubs.NewStorageModuleStub(client)
 	identity := stubs.NewIdentityManagerStub(client)
-	store, err := bcdbClient()
+	cl, err := bcdbClient()
 	if err != nil {
 		log.Fatal().Err(err).Msg("failed to connect to bcdb backend")
 	}
@@ -62,7 +64,13 @@ func cap(ctx context.Context, client zbus.Client) {
 	}
 
 	log.Info().Msg("sends capacity detail to BCDB")
-	if err := store.Register(identity.NodeID(), *resources, *dmi, disks, hypervisor); err != nil {
+
+	if err := cl.NodeSetCapacity(identity.NodeID().Identity(), directory.ResourceAmount{
+		Cru: int64(resources.CRU),
+		Mru: int64(resources.MRU),
+		Hru: int64(resources.HRU),
+		Sru: int64(resources.SRU),
+	}, *dmi, disks, hypervisor); err != nil {
 		log.Fatal().Err(err).Msgf("failed to write resources capacity on BCDB")
 	}
 
@@ -74,7 +82,7 @@ func cap(ctx context.Context, client zbus.Client) {
 		}
 
 		log.Info().Msg("send heart-beat to BCDB")
-		if err := store.Ping(identity.NodeID(), uptime); err != nil {
+		if err := cl.NodeUpdateUptime(identity.NodeID().Identity(), uptime); err != nil {
 			log.Error().Err(err).Msgf("failed to send heart-beat to BCDB")
 			return err
 		}
@@ -154,12 +162,17 @@ func main() {
 }
 
 // instantiate the proper client based on the running mode
-func bcdbClient() (capacity.Store, error) {
+func bcdbClient() (client.Directory, error) {
 	env, err := environment.Get()
 	if err != nil {
 		return nil, errors.Wrap(err, "failed to parse node environment")
 	}
 
-	return capacity.NewHTTPStore(env.BcdbURL), nil
+	cl, err := client.NewClient(env.BcdbURL)
+	if err != nil {
+		return nil, err
+	}
+
+	return cl.Directory, nil
 
 }
diff --git a/cmds/identityd/main.go b/cmds/identityd/main.go
index 5387786e..22409ea4 100644
--- a/cmds/identityd/main.go
+++ b/cmds/identityd/main.go
@@ -13,8 +13,11 @@ import (
 	"github.com/threefoldtech/zos/pkg/app"
 	"github.com/threefoldtech/zos/pkg/flist"
 	"github.com/threefoldtech/zos/pkg/geoip"
+	"github.com/threefoldtech/zos/pkg/network"
 	"github.com/threefoldtech/zos/pkg/stubs"
 	"github.com/threefoldtech/zos/pkg/upgrade"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/directory"
+	"github.com/threefoldtech/zos/tools/client"
 
 	"github.com/cenkalti/backoff/v3"
 	"github.com/threefoldtech/zos/pkg"
@@ -436,22 +439,43 @@ func identityMgr(root string) (pkg.IdentityManager, error) {
 }
 
 // instantiate the proper client based on the running mode
-func bcdbClient() (identity.IDStore, error) {
+func bcdbClient() (client.Directory, error) {
 	env, err := environment.Get()
 	if err != nil {
 		return nil, errors.Wrap(err, "failed to parse node environment")
 	}
 
-	return identity.NewHTTPIDStore(env.BcdbURL), nil
+	cl, err := client.NewClient(env.BcdbURL)
+	if err != nil {
+		return nil, err
+	}
+
+	return cl.Directory, nil
 }
 
-func registerNode(nodeID pkg.Identifier, farmID pkg.FarmID, version string, store identity.IDStore, loc geoip.Location) error {
+func registerNode(nodeID pkg.Identifier, farmID pkg.FarmID, version string, store client.Directory, loc geoip.Location) error {
 	log.Info().Str("version", version).Msg("start registration of the node")
 
-	_, err := store.RegisterNode(nodeID, farmID, version, loc)
+	v1ID, _ := network.NodeIDv1()
+
+	err := store.NodeRegister(directory.Node{
+		NodeId:    nodeID.Identity(),
+		NodeIdV1:  v1ID,
+		FarmId:    int64(farmID),
+		OsVersion: version,
+		Location: directory.Location{
+			Continent: loc.Continent,
+			Country:   loc.Country,
+			City:      loc.City,
+			Longitude: loc.Longitute,
+			Latitude:  loc.Latitude,
+		},
+	})
+
 	if err != nil {
 		log.Error().Err(err).Send()
 		return err
 	}
+
 	return nil
 }
diff --git a/cmds/networkd/addr_watcher.go b/cmds/networkd/addr_watcher.go
index bc0e3675..b87458cb 100644
--- a/cmds/networkd/addr_watcher.go
+++ b/cmds/networkd/addr_watcher.go
@@ -10,20 +10,21 @@ import (
 
 	"github.com/cenkalti/backoff/v3"
 	"github.com/threefoldtech/zos/pkg"
-	"github.com/threefoldtech/zos/pkg/network"
 	"github.com/threefoldtech/zos/pkg/network/ifaceutil"
 	"github.com/threefoldtech/zos/pkg/network/types"
 	"github.com/threefoldtech/zos/pkg/schema"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/directory"
+	"github.com/threefoldtech/zos/tools/client"
 	"github.com/vishvananda/netlink"
 )
 
 type WatchedLinks struct {
 	linkNames map[string]struct{}
-	bcdb      network.TNoDB
+	dir       client.Directory
 	nodeID    pkg.Identifier
 }
 
-func NewWatchedLinks(linkNames []string, nodeID pkg.Identifier, db network.TNoDB) WatchedLinks {
+func NewWatchedLinks(linkNames []string, nodeID pkg.Identifier, dir client.Directory) WatchedLinks {
 	names := make(map[string]struct{}, len(linkNames))
 
 	for _, n := range linkNames {
@@ -32,7 +33,7 @@ func NewWatchedLinks(linkNames []string, nodeID pkg.Identifier, db network.TNoDB
 
 	return WatchedLinks{
 		linkNames: names,
-		bcdb:      db,
+		dir:       dir,
 		nodeID:    nodeID,
 	}
 }
@@ -55,7 +56,7 @@ func (w WatchedLinks) callBack(update netlink.AddrUpdate) error {
 		return err
 	}
 
-	return publishIfaces(ifaces, w.nodeID, w.bcdb)
+	return publishIfaces(ifaces, w.nodeID, w.dir)
 }
 
 func (w WatchedLinks) Forever(ctx context.Context) error {
@@ -140,10 +141,14 @@ func getLocalInterfaces() ([]types.IfaceInfo, error) {
 	return output, err
 }
 
-func publishIfaces(ifaces []types.IfaceInfo, id pkg.Identifier, db network.TNoDB) error {
+func publishIfaces(ifaces []types.IfaceInfo, id pkg.Identifier, db client.Directory) error {
 	f := func() error {
 		log.Info().Msg("try to publish interfaces to TNoDB")
-		return db.PublishInterfaces(id, ifaces)
+		var input []directory.Iface
+		for _, inf := range ifaces {
+			input = append(input, inf.ToSchema())
+		}
+		return db.NodeSetInterfaces(id.Identity(), input)
 	}
 	errHandler := func(err error, _ time.Duration) {
 		if err != nil {
diff --git a/cmds/networkd/main.go b/cmds/networkd/main.go
index bc395b70..c26ce6a7 100644
--- a/cmds/networkd/main.go
+++ b/cmds/networkd/main.go
@@ -17,11 +17,11 @@ import (
 	"github.com/threefoldtech/zos/pkg/network"
 	"github.com/threefoldtech/zos/pkg/network/bootstrap"
 	"github.com/threefoldtech/zos/pkg/network/ndmz"
-	"github.com/threefoldtech/zos/pkg/network/tnodb"
 	"github.com/threefoldtech/zos/pkg/network/types"
 	"github.com/threefoldtech/zos/pkg/stubs"
 	"github.com/threefoldtech/zos/pkg/utils"
 	"github.com/threefoldtech/zos/pkg/version"
+	"github.com/threefoldtech/zos/tools/client"
 )
 
 const redisSocket = "unix:///var/run/redis.sock"
@@ -54,7 +54,7 @@ func main() {
 		log.Fatal().Err(err).Msg("failed to connect to zbus broker")
 	}
 
-	db, err := bcdbClient()
+	dir, err := bcdbClient()
 	if err != nil {
 		log.Fatal().Err(err).Msg("failed to connect to BCDB")
 	}
@@ -74,12 +74,13 @@ func main() {
 	if err != nil {
 		log.Fatal().Err(err).Msg("failed to read local network interfaces")
 	}
-	if err := publishIfaces(ifaces, nodeID, db); err != nil {
+	if err := publishIfaces(ifaces, nodeID, dir); err != nil {
 		log.Fatal().Err(err).Msg("failed to publish network interfaces to BCDB")
 	}
 
 	ifaceVersion := -1
-	exitIface, err := db.GetPubIface(nodeID)
+
+	exitIface, err := getPubIface(dir, nodeID.Identity())
 	if err == nil {
 		if err := configurePubIface(exitIface, nodeID); err != nil {
 			log.Error().Err(err).Msg("failed to configure public interface")
@@ -92,7 +93,7 @@ func main() {
 		log.Fatal().Err(err).Msgf("failed to create DMZ")
 	}
 
-	chIface := watchPubIface(ctx, nodeID, db, ifaceVersion)
+	chIface := watchPubIface(ctx, nodeID, dir, ifaceVersion)
 	go func(ctx context.Context, ch <-chan *types.PubIface) {
 		for {
 			select {
@@ -124,14 +125,14 @@ func main() {
 		}
 	}(ctx, chIface)
 
-	go startAddrWatch(ctx, nodeID, db, ifaces)
+	go startAddrWatch(ctx, nodeID, dir, ifaces)
 
 	log.Info().Msg("start zbus server")
 	if err := os.MkdirAll(root, 0750); err != nil {
 		log.Fatal().Err(err).Msgf("fail to create module root")
 	}
 
-	networker, err := network.NewNetworker(identity, db, root)
+	networker, err := network.NewNetworker(identity, dir, root)
 	if err != nil {
 		log.Fatal().Err(err).Msg("error creating network manager")
 	}
@@ -162,7 +163,7 @@ func startServer(ctx context.Context, broker string, networker pkg.Networker) er
 	return nil
 }
 
-func startAddrWatch(ctx context.Context, nodeID pkg.Identifier, db network.TNoDB, ifaces []types.IfaceInfo) {
+func startAddrWatch(ctx context.Context, nodeID pkg.Identifier, cl client.Directory, ifaces []types.IfaceInfo) {
 
 	ifaceNames := make([]string, len(ifaces))
 	for i, iface := range ifaces {
@@ -171,7 +172,7 @@ func startAddrWatch(ctx context.Context, nodeID pkg.Identifier, db network.TNoDB
 	log.Info().Msgf("watched interfaces %v", ifaceNames)
 
 	f := func() error {
-		wl := NewWatchedLinks(ifaceNames, nodeID, db)
+		wl := NewWatchedLinks(ifaceNames, nodeID, cl)
 		if err := wl.Forever(ctx); err != nil {
 			log.Error().Err(err).Msg("error in address watcher")
 			return err
@@ -186,11 +187,15 @@ func startAddrWatch(ctx context.Context, nodeID pkg.Identifier, db network.TNoDB
 }
 
 // instantiate the proper client based on the running mode
-func bcdbClient() (network.TNoDB, error) {
+func bcdbClient() (client.Directory, error) {
 	env, err := environment.Get()
 	if err != nil {
 		return nil, errors.Wrap(err, "failed to parse node environment")
 	}
 
-	return tnodb.NewHTTPTNoDB(env.BcdbURL), nil
+	cl, err := client.NewClient(env.BcdbURL)
+	if err != nil {
+		return nil, err
+	}
+	return cl.Directory, nil
 }
diff --git a/cmds/networkd/pubiface.go b/cmds/networkd/pubiface.go
index 32ff4dab..b080849a 100644
--- a/cmds/networkd/pubiface.go
+++ b/cmds/networkd/pubiface.go
@@ -10,9 +10,28 @@ import (
 	"github.com/threefoldtech/zos/pkg/network"
 	"github.com/threefoldtech/zos/pkg/network/namespace"
 	"github.com/threefoldtech/zos/pkg/network/types"
+	"github.com/threefoldtech/zos/tools/client"
 )
 
-func watchPubIface(ctx context.Context, nodeID pkg.Identifier, db network.TNoDB, ifaceVersion int) <-chan *types.PubIface {
+// ErrNoPubIface is the error returns by ReadPubIface when no public
+// interface is configured
+var ErrNoPubIface = errors.New("no public interface configured for this node")
+
+func getPubIface(dir client.Directory, nodeID string) (*types.PubIface, error) {
+	schemaNode, err := dir.NodeGet(nodeID, false)
+	if err != nil {
+		return nil, err
+	}
+
+	node := types.NewNodeFromSchema(schemaNode)
+	if node.PublicConfig == nil {
+		return nil, ErrNoPubIface
+	}
+
+	return node.PublicConfig, nil
+}
+
+func watchPubIface(ctx context.Context, nodeID pkg.Identifier, dir client.Directory, ifaceVersion int) <-chan *types.PubIface {
 	var currentVersion = ifaceVersion
 
 	ch := make(chan *types.PubIface)
@@ -28,9 +47,9 @@ func watchPubIface(ctx context.Context, nodeID pkg.Identifier, db network.TNoDB,
 				break
 			}
 
-			exitIface, err := db.GetPubIface(nodeID)
+			exitIface, err := getPubIface(dir, nodeID.Identity())
 			if err != nil {
-				if err == network.ErrNoPubIface {
+				if err == ErrNoPubIface {
 					continue
 				}
 				log.Error().Err(err).Msg("failed to read public interface")
diff --git a/cmds/provisiond/main.go b/cmds/provisiond/main.go
index 4a1488b9..15d9577e 100644
--- a/cmds/provisiond/main.go
+++ b/cmds/provisiond/main.go
@@ -11,6 +11,7 @@ import (
 	"github.com/threefoldtech/zos/pkg"
 	"github.com/threefoldtech/zos/pkg/app"
 	"github.com/threefoldtech/zos/pkg/environment"
+	"github.com/threefoldtech/zos/tools/client"
 
 	"github.com/threefoldtech/zos/pkg/stubs"
 	"github.com/threefoldtech/zos/pkg/utils"
@@ -91,7 +92,7 @@ func main() {
 	nodeID := identity.NodeID()
 
 	// to get reservation from tnodb
-	remoteStore, err := bcdbClient()
+	cl, err := bcdbClient()
 	if err != nil {
 		log.Fatal().Err(err).Msg("failed to instantiate BCDB client")
 	}
@@ -101,7 +102,7 @@ func main() {
 		log.Fatal().Err(err).Msg("failed to create local reservation store")
 	}
 	// to get the user ID of a reservation
-	ownerCache := provision.NewCache(localStore, remoteStore)
+	ownerCache := provision.NewCache(localStore, provision.ReservationGetterFromWorkloads(cl.Workloads))
 
 	// create context and add middlewares
 	ctx := context.Background()
@@ -111,11 +112,11 @@ func main() {
 	// From here we start the real provision engine that will live
 	// for the rest of the life of the node
 	source := provision.CombinedSource(
-		provision.PollSource(remoteStore, nodeID),
+		provision.PollSource(provision.ReservationPollerFromWorkloads(cl.Workloads), nodeID),
 		provision.NewDecommissionSource(localStore),
 	)
 
-	engine := provision.New(nodeID.Identity(), source, localStore, remoteStore)
+	engine := provision.New(nodeID.Identity(), source, localStore, cl)
 
 	server.Register(zbus.ObjectID{Name: module, Version: "0.0.1"}, pkg.ProvisionMonitor(engine))
 
@@ -148,11 +149,11 @@ type store interface {
 }
 
 // instantiate the proper client based on the running mode
-func bcdbClient() (store, error) {
+func bcdbClient() (*client.Client, error) {
 	env, err := environment.Get()
 	if err != nil {
 		return nil, errors.Wrap(err, "failed to parse node environment")
 	}
 
-	return provision.NewHTTPStore(env.BcdbURL), nil
+	return client.NewClient(env.BcdbURL)
 }
diff --git a/pkg/capacity/store.go b/pkg/capacity/store.go
deleted file mode 100644
index f56b9648..00000000
--- a/pkg/capacity/store.go
+++ /dev/null
@@ -1,112 +0,0 @@
-package capacity
-
-import (
-	"bytes"
-	"encoding/json"
-	"fmt"
-	"net/http"
-
-	"github.com/threefoldtech/zos/pkg/capacity/dmi"
-	"github.com/threefoldtech/zos/pkg/gedis"
-
-	"github.com/threefoldtech/zos/pkg"
-)
-
-// Store is an interface to the bcdb store to report capacity
-type Store interface {
-	Register(nodeID pkg.Identifier, c Capacity, d dmi.DMI, disks Disks, hypervisor []string) error
-	Ping(nodeID pkg.Identifier, uptime uint64) error
-}
-
-// BCDBStore implements the store interface using a gedis client to BCDB
-type BCDBStore struct {
-	g *gedis.Gedis
-}
-
-// NewBCDBStore creates a BCDBStore
-func NewBCDBStore(gedis *gedis.Gedis) *BCDBStore {
-	return &BCDBStore{g: gedis}
-}
-
-// Register sends the capacity information to BCDB
-func (s *BCDBStore) Register(nodeID pkg.Identifier, c Capacity, d dmi.DMI, disks Disks, hypervisor []string) error {
-	if err := s.g.UpdateTotalNodeCapacity(nodeID, c.MRU, c.CRU, c.HRU, c.SRU); err != nil {
-		return err
-	}
-
-	return s.g.SendHardwareProof(nodeID, d, disks, hypervisor)
-}
-
-// Ping sends an heart-beat to BCDB
-func (s *BCDBStore) Ping(nodeID pkg.Identifier, uptime uint64) error {
-	return s.g.UptimeUpdate(nodeID, uptime)
-}
-
-// HTTPStore implement the method to push capacity information to BCDB over HTTP
-type HTTPStore struct {
-	baseURL string
-}
-
-// NewHTTPStore create a new HTTPStore
-func NewHTTPStore(url string) *HTTPStore {
-	return &HTTPStore{url}
-}
-
-// Register sends the capacity information to BCDB
-func (s *HTTPStore) Register(nodeID pkg.Identifier, c Capacity, d dmi.DMI, disks Disks, hypervisor []string) error {
-	x := struct {
-		Capacity   Capacity `json:"capacity"`
-		DMI        dmi.DMI  `json:"dmi"`
-		Disks      Disks    `json:"disks"`
-		Hypervisor []string `json:"hypervisor"`
-	}{
-		Capacity:   c,
-		DMI:        d,
-		Disks:      disks,
-		Hypervisor: hypervisor,
-	}
-	buf := bytes.Buffer{}
-	err := json.NewEncoder(&buf).Encode(x)
-	if err != nil {
-		return err
-	}
-
-	url := fmt.Sprintf(s.baseURL+"/nodes/%s/capacity", nodeID.Identity())
-	resp, err := http.Post(url, "application/json", &buf)
-	if err != nil {
-		return err
-	}
-	defer resp.Body.Close()
-
-	if resp.StatusCode != http.StatusOK {
-		return fmt.Errorf("wrong response status code received: %v", resp.Status)
-	}
-
-	return nil
-}
-
-// Ping sends an heart-beat to BCDB
-func (s *HTTPStore) Ping(nodeID pkg.Identifier, uptime uint64) error {
-	x := struct {
-		Uptime uint64 `json:"uptime"`
-	}{uptime}
-
-	buf := bytes.Buffer{}
-	err := json.NewEncoder(&buf).Encode(x)
-	if err != nil {
-		return err
-	}
-
-	url := fmt.Sprintf(s.baseURL+"/nodes/%s/uptime", nodeID.Identity())
-	resp, err := http.Post(url, "application/json", &buf)
-	if err != nil {
-		return err
-	}
-	defer resp.Body.Close()
-
-	if resp.StatusCode != http.StatusOK {
-		return fmt.Errorf("wrong response status code received: %v", resp.Status)
-	}
-
-	return nil
-}
diff --git a/pkg/gedis/commands_capacity.go b/pkg/gedis/commands_capacity.go
deleted file mode 100644
index 9958d0ac..00000000
--- a/pkg/gedis/commands_capacity.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package gedis
-
-import (
-	"github.com/threefoldtech/zos/pkg"
-	"github.com/threefoldtech/zos/pkg/gedis/types/directory"
-)
-
-//UptimeUpdate send the uptime of the node to BCDB
-func (g *Gedis) UptimeUpdate(nodeID pkg.Identifier, uptime uint64) error {
-
-	_, err := g.Send("tfgrid.directory.nodes", "uptime_update", Args{
-		"node_id": nodeID.Identity(),
-		"uptime":  uptime,
-	})
-
-	return err
-}
-
-func (g *Gedis) updateGenericNodeCapacity(captype string, node pkg.Identifier, mru, cru, hru, sru uint64) error {
-	_, err := g.Send("tfgrid.directory.nodes", "update_"+captype+"_capacity", Args{
-		"node_id": node.Identity(),
-		"resource": directory.TfgridNodeResourceAmount1{
-			Cru: int64(cru),
-			Mru: int64(mru),
-			Hru: int64(hru),
-			Sru: int64(sru),
-		},
-	})
-
-	return err
-}
-
-//UpdateTotalNodeCapacity implements pkg.IdentityManager interface
-func (g *Gedis) UpdateTotalNodeCapacity(node pkg.Identifier, mru, cru, hru, sru uint64) error {
-	return g.updateGenericNodeCapacity("total", node, mru, cru, hru, sru)
-}
-
-//UpdateReservedNodeCapacity implements pkg.IdentityManager interface
-func (g *Gedis) UpdateReservedNodeCapacity(node pkg.Identifier, mru, cru, hru, sru uint64) error {
-	return g.updateGenericNodeCapacity("reserved", node, mru, cru, hru, sru)
-}
-
-//UpdateUsedNodeCapacity implements pkg.IdentityManager interface
-func (g *Gedis) UpdateUsedNodeCapacity(node pkg.Identifier, mru, cru, hru, sru uint64) error {
-	return g.updateGenericNodeCapacity("used", node, mru, cru, hru, sru)
-}
-
-// SendHardwareProof sends a dump of hardware and disks to BCDB
-func (g *Gedis) SendHardwareProof(node pkg.Identifier, dmi interface{}, disks interface{}, hypervisor []string) error {
-	_, err := g.Send("tfgrid.directory.nodes", "add_proof", Args{
-		"node_id": node.Identity(),
-		"proof": map[string]interface{}{
-			"hardware":   dmi,
-			"disks":      disks,
-			"hypervisor": hypervisor,
-		},
-	})
-
-	return err
-}
diff --git a/pkg/gedis/commands_identity.go b/pkg/gedis/commands_identity.go
deleted file mode 100644
index 4c41cb8d..00000000
--- a/pkg/gedis/commands_identity.go
+++ /dev/null
@@ -1,245 +0,0 @@
-package gedis
-
-import (
-	"encoding/hex"
-	"encoding/json"
-	"fmt"
-	"strconv"
-
-	"github.com/jbenet/go-base58"
-
-	"github.com/pkg/errors"
-	"github.com/threefoldtech/zos/pkg/gedis/types/directory"
-	"github.com/threefoldtech/zos/pkg/network"
-	"github.com/threefoldtech/zos/pkg/network/types"
-
-	"github.com/threefoldtech/zos/pkg"
-	"github.com/threefoldtech/zos/pkg/geoip"
-)
-
-//
-// IDStore Interface
-//
-
-//RegisterNode implements pkg.IdentityManager interface
-func (g *Gedis) RegisterNode(nodeID pkg.Identifier, farmID pkg.FarmID, version string, location geoip.Location) (string, error) {
-
-	pk := base58.Decode(nodeID.Identity())
-	node := directory.TfgridNode2{
-		NodeID:       nodeID.Identity(),
-		FarmID:       uint64(farmID),
-		OsVersion:    version,
-		PublicKeyHex: hex.EncodeToString(pk),
-		Location: directory.TfgridLocation1{
-			Longitude: location.Longitute,
-			Latitude:  location.Latitude,
-			Continent: location.Continent,
-			Country:   location.Country,
-			City:      location.City,
-		},
-	}
-	idv1, err := network.NodeIDv1()
-	if err == nil {
-		node.NodeIDv1 = idv1
-	}
-
-	resp, err := Bytes(g.Send("tfgrid.directory.nodes", "add", Args{"node": node}))
-
-	if err != nil {
-		return "", err
-	}
-
-	var out directory.TfgridNode2
-
-	if err := json.Unmarshal(resp, &out); err != nil {
-		return "", err
-	}
-
-	// no need to do data conversion here, returns the id
-	return out.NodeID, nil
-}
-
-// ListNode implements pkg.IdentityManager interface
-func (g *Gedis) ListNode(farmID pkg.FarmID, country string, city string) ([]types.Node, error) {
-	resp, err := Bytes(g.Send("tfgrid.directory.nodes", "list", Args{
-		"farm_id": farmID,
-		"country": country,
-		"city":    city,
-	}))
-
-	if err != nil {
-		return nil, err
-	}
-
-	var out struct {
-		Nodes []directory.TfgridNode2 `json:"nodes"`
-	}
-
-	if err := json.Unmarshal(resp, &out); err != nil {
-		return nil, err
-	}
-
-	var result []types.Node
-	for _, node := range out.Nodes {
-		result = append(result, nodeFromSchema(node))
-	}
-
-	return result, nil
-}
-
-//RegisterFarm implements pkg.IdentityManager interface
-func (g *Gedis) RegisterFarm(tid uint64, name string, email string, wallet []string) (pkg.FarmID, error) {
-	resp, err := Bytes(g.Send("tfgrid.directory.farms", "register", Args{
-		"farm": directory.TfgridFarm1{
-			ThreebotID:      tid,
-			Name:            name,
-			Email:           email,
-			WalletAddresses: wallet,
-		},
-	}))
-
-	if err != nil {
-		return 0, err
-	}
-
-	var out struct {
-		FarmID json.Number `json:"farm_id"`
-	}
-
-	if err := json.Unmarshal(resp, &out); err != nil {
-		return 0, err
-	}
-
-	id, err := out.FarmID.Int64()
-	if err != nil {
-		return 0, err
-	}
-
-	return pkg.FarmID(id), nil
-}
-
-//GetNode implements pkg.IdentityManager interface
-func (g *Gedis) GetNode(nodeID pkg.Identifier) (*types.Node, error) {
-	resp, err := Bytes(g.Send("tfgrid.directory.nodes", "get", Args{
-		"node_id": nodeID.Identity(),
-	}))
-
-	if err != nil {
-		return nil, err
-	}
-
-	var out directory.TfgridNode2
-
-	if err := json.Unmarshal(resp, &out); err != nil {
-		return nil, err
-	}
-
-	node := nodeFromSchema(out)
-	return &node, nil
-}
-
-func infFromSchema(inf directory.TfgridNodeIface1) types.IfaceInfo {
-	return types.IfaceInfo{
-		Name:    inf.Name,
-		Gateway: inf.Gateway,
-		Addrs: func() []types.IPNet {
-			var r []types.IPNet
-			for _, addr := range inf.Addrs {
-				r = append(r, types.NewIPNetFromSchema(addr))
-			}
-			return r
-		}(),
-		MacAddress: inf.MacAddress,
-	}
-}
-
-func nodeFromSchema(node directory.TfgridNode2) types.Node {
-	return types.Node{
-		NodeID: node.NodeID,
-		FarmID: node.FarmID,
-		Ifaces: func() []*types.IfaceInfo {
-			var r []*types.IfaceInfo
-			for _, iface := range node.Ifaces {
-				v := infFromSchema(iface)
-				r = append(r, &v)
-			}
-			return r
-		}(),
-		PublicConfig: func() *types.PubIface {
-			cfg := node.PublicConfig
-			if cfg == nil || cfg.Master == "" {
-				return nil
-			}
-			pub := types.PubIface{
-				Master:  cfg.Master,
-				Type:    types.IfaceType(cfg.Type.String()),
-				IPv4:    types.NewIPNetFromSchema(cfg.Ipv4),
-				IPv6:    types.NewIPNetFromSchema(cfg.Ipv6),
-				GW4:     cfg.Gw4,
-				GW6:     cfg.Gw6,
-				Version: int(cfg.Version),
-			}
-
-			return &pub
-		}(),
-		WGPorts: node.WGPorts,
-	}
-}
-
-func farmFromSchema(farm directory.TfgridFarm1) network.Farm {
-	return network.Farm{
-		ID:   fmt.Sprint(farm.ID),
-		Name: farm.Name,
-	}
-}
-
-//GetFarm implements pkg.IdentityManager interface
-func (g *Gedis) GetFarm(farm pkg.Identifier) (*network.Farm, error) {
-	id, err := strconv.ParseInt(farm.Identity(), 10, 64)
-	if err != nil {
-		return nil, errors.Wrap(err, "invalid farm id")
-	}
-
-	resp, err := Bytes(g.Send("tfgrid.directory.farms", "get", Args{
-		"farm_id": id,
-	}))
-
-	if err != nil {
-		return nil, err
-	}
-
-	var out directory.TfgridFarm1
-
-	if err := json.Unmarshal(resp, &out); err != nil {
-		return nil, err
-	}
-	f := farmFromSchema(out)
-	return &f, nil
-}
-
-//ListFarm implements pkg.IdentityManager interface
-func (g *Gedis) ListFarm(country string, city string) ([]network.Farm, error) {
-	resp, err := Bytes(g.Send("tfgrid.directory.farms", "list", Args{
-		"country": country,
-		"city":    city,
-	}))
-
-	if err != nil {
-		return nil, err
-	}
-
-	var out struct {
-		Farms []directory.TfgridFarm1 `json:"farms"`
-	}
-
-	if err := json.Unmarshal(resp, &out); err != nil {
-		return nil, err
-	}
-
-	var result []network.Farm
-	for _, farm := range out.Farms {
-		result = append(result, farmFromSchema(farm))
-	}
-
-	return result, nil
-}
diff --git a/pkg/gedis/commands_network.go b/pkg/gedis/commands_network.go
deleted file mode 100644
index ded60c50..00000000
--- a/pkg/gedis/commands_network.go
+++ /dev/null
@@ -1,93 +0,0 @@
-package gedis
-
-import (
-	"github.com/threefoldtech/zos/pkg"
-	"github.com/threefoldtech/zos/pkg/gedis/types/directory"
-	"github.com/threefoldtech/zos/pkg/network"
-	"github.com/threefoldtech/zos/pkg/network/types"
-	"github.com/threefoldtech/zos/pkg/schema"
-)
-
-func (g *Gedis) getLocalInterfaces(ifaces []types.IfaceInfo) []directory.TfgridNodeIface1 {
-	output := make([]directory.TfgridNodeIface1, 0, len(ifaces))
-	for _, iface := range ifaces {
-		output = append(output,
-			directory.TfgridNodeIface1{
-				Name: iface.Name,
-				Addrs: func() []schema.IPRange {
-					var o []schema.IPRange
-					for _, r := range iface.Addrs {
-						o = append(o, r.ToSchema())
-					}
-					return o
-				}(),
-				Gateway:    iface.Gateway,
-				MacAddress: iface.MacAddress,
-			},
-		)
-	}
-
-	return output
-}
-
-//PublishInterfaces implements network.TNoDB interface
-func (g *Gedis) PublishInterfaces(local pkg.Identifier, ifaces []types.IfaceInfo) error {
-	output := g.getLocalInterfaces(ifaces)
-
-	_, err := g.Send("tfgrid.directory.nodes", "publish_interfaces", Args{
-		"node_id": local.Identity(),
-		"ifaces":  output,
-	})
-
-	return err
-}
-
-//GetPubIface gets public config of a node
-func (g *Gedis) GetPubIface(node pkg.Identifier) (*types.PubIface, error) {
-	object, err := g.GetNode(node)
-	if err != nil {
-		return nil, err
-	}
-
-	if object.PublicConfig == nil {
-		return nil, network.ErrNoPubIface
-	}
-
-	return object.PublicConfig, nil
-}
-
-//SetPublicIface implements network.TNoDB interface
-func (g *Gedis) SetPublicIface(node pkg.Identifier, pub *types.PubIface) error {
-	public := directory.TfgridNodePublicIface1{
-		Master:  pub.Master,
-		Type:    directory.TfgridNodePublicIface1TypeMacvlan,
-		Version: int64(pub.Version),
-	}
-
-	if !pub.IPv4.Nil() {
-		public.Ipv4 = pub.IPv4.ToSchema()
-		public.Gw4 = pub.GW4
-	}
-
-	if !pub.IPv6.Nil() {
-		public.Ipv6 = pub.IPv6.ToSchema()
-		public.Gw6 = pub.GW6
-	}
-
-	_, err := g.Send("tfgrid.directory.nodes", "set_public_iface", Args{
-		"node_id": node.Identity(),
-		"public":  public,
-	})
-
-	return err
-}
-
-//PublishWGPort implements network.TNoDB interface
-func (g *Gedis) PublishWGPort(node pkg.Identifier, ports []uint) error {
-	_, err := g.Send("tfgrid.directory.nodes", "publish_wg_ports", Args{
-		"node_id": node.Identity(),
-		"ports":   ports,
-	})
-
-	return err
-}
diff --git a/pkg/gedis/commands_provision.go b/pkg/gedis/commands_provision.go
deleted file mode 100644
index aa144b3e..00000000
--- a/pkg/gedis/commands_provision.go
+++ /dev/null
@@ -1,170 +0,0 @@
-package gedis
-
-import (
-	"encoding/json"
-	"fmt"
-	"sort"
-
-	"github.com/threefoldtech/zos/pkg/schema"
-
-	dtypes "github.com/threefoldtech/zos/pkg/gedis/types/directory"
-	ptypes "github.com/threefoldtech/zos/pkg/gedis/types/provision"
-	"github.com/threefoldtech/zos/pkg/provision"
-
-	"github.com/threefoldtech/zos/pkg"
-)
-
-// provisionOrder is used to sort the workload type
-// in the right order for provisiond
-var provisionOrder = map[provision.ReservationType]int{
-	provision.DebugReservation:      0,
-	provision.NetworkReservation:    1,
-	provision.ZDBReservation:        2,
-	provision.VolumeReservation:     3,
-	provision.ContainerReservation:  4,
-	provision.KubernetesReservation: 5,
-}
-
-// Reserve provision.Reserver
-func (g *Gedis) Reserve(r *provision.Reservation) (string, error) {
-	res, err := ReservationToSchemaType(r)
-	if err != nil {
-		return "", err
-	}
-
-	result, err := Bytes(g.Send("tfgrid.workloads.workload_manager", "reservation_register", Args{
-		"reservation": res,
-	}))
-
-	if err != nil {
-		return "", err
-	}
-
-	res = ptypes.TfgridReservation1{}
-	if err = json.Unmarshal(result, &res); err != nil {
-		return "", err
-	}
-
-	return fmt.Sprintf("%d", res.ID), nil
-}
-
-// Get implements provision.ReservationGetter
-func (g *Gedis) Get(id string) (*provision.Reservation, error) {
-	result, err := Bytes(g.Send("tfgrid.workloads.workload_manager", "workload_get", Args{
-		"gwid": id,
-	}))
-
-	if err != nil {
-		return nil, err
-	}
-
-	var workload ptypes.TfgridReservationWorkload1
-
-	if err = json.Unmarshal(result, &workload); err != nil {
-		return nil, err
-	}
-
-	return provision.WorkloadToProvisionType(workload)
-}
-
-// Poll retrieves reservations from BCDB. from acts like a cursor, first call should use
-// 0  to retrieve everything. Next calls should use the last (MAX) ID of the previous poll.
-// Note that from is a reservation ID not a workload ID. so user the Reservation.SplitID() method
-// to get the reservation part.
-func (g *Gedis) Poll(nodeID pkg.Identifier, from uint64) ([]*provision.Reservation, error) {
-
-	result, err := Bytes(g.Send("tfgrid.workloads.workload_manager", "workloads_list", Args{
-		"node_id": nodeID.Identity(),
-		"cursor":  from,
-	}))
-
-	if err != nil {
-		return nil, provision.NewErrTemporary(err)
-	}
-
-	var out struct {
-		Workloads []ptypes.TfgridReservationWorkload1 `json:"workloads"`
-	}
-
-	if err = json.Unmarshal(result, &out); err != nil {
-		return nil, err
-	}
-
-	reservations := make([]*provision.Reservation, len(out.Workloads))
-	for i, w := range out.Workloads {
-		r, err := provision.WorkloadToProvisionType(w)
-		if err != nil {
-			return nil, err
-		}
-		reservations[i] = r
-	}
-
-	// sorts the primitive in the oder they need to be processed by provisiond
-	// network, zdb, volumes, container
-	sort.Slice(reservations, func(i int, j int) bool {
-		return provisionOrder[reservations[i].Type] < provisionOrder[reservations[j].Type]
-	})
-
-	return reservations, nil
-}
-
-// Feedback implements provision.Feedbacker
-func (g *Gedis) Feedback(nodeID string, r *provision.Result) error {
-
-	var rType ptypes.TfgridReservationResult1CategoryEnum
-	switch r.Type {
-	case provision.VolumeReservation:
-		rType = ptypes.TfgridReservationResult1CategoryVolume
-	case provision.ContainerReservation:
-		rType = ptypes.TfgridReservationResult1CategoryContainer
-	case provision.ZDBReservation:
-		rType = ptypes.TfgridReservationResult1CategoryZdb
-	case provision.NetworkReservation:
-		rType = ptypes.TfgridReservationResult1CategoryNetwork
-	}
-
-	result := ptypes.TfgridReservationResult1{
-		Category:   rType,
-		WorkloadID: r.ID,
-		DataJSON:   r.Data,
-		Signature:  r.Signature,
-		State:      ptypes.TfgridReservationResult1StateEnum(r.State),
-		Message:    r.Error,
-		Epoch:      schema.Date{r.Created},
-	}
-
-	_, err := g.Send("tfgrid.workloads.workload_manager", "set_workload_result", Args{
-		"global_workload_id": r.ID,
-		"result":             result,
-	})
-	return err
-}
-
-//UpdateReservedResources sends current reserved resources
-func (g *Gedis) UpdateReservedResources(nodeID string, c provision.Counters) error {
-	r := dtypes.TfgridNodeResourceAmount1{
-		Cru: c.CRU.Current(),
-		Mru: c.MRU.Current(),
-		Hru: c.HRU.Current(),
-		Sru: c.SRU.Current(),
-	}
-	_, err := g.Send("tfgrid.directory.nodes", "update_reserved_capacity", Args{
-		"node_id":   nodeID,
-		"resources": r,
-	})
-	return err
-}
-
-// Deleted implements provision.Feedbacker
-func (g *Gedis) Deleted(nodeID, id string) error {
-	_, err := g.Send("tfgrid.workloads.workload_manager", "workload_deleted", Args{"workload_id": id})
-	return err
-}
-
-// Delete marks a reservation to be deleted
-func (g *Gedis) Delete(id string) error {
-	_, err := g.Send("tfgrid.workloads.workload_manager", "sign_delete", Args{
-		"reservation_id": id,
-	})
-	return err
-}
diff --git a/pkg/gedis/converter.go b/pkg/gedis/converter.go
deleted file mode 100644
index f16a7769..00000000
--- a/pkg/gedis/converter.go
+++ /dev/null
@@ -1,238 +0,0 @@
-package gedis
-
-import (
-	"encoding/json"
-	"fmt"
-	"net"
-	"time"
-
-	"github.com/threefoldtech/zos/pkg"
-	"github.com/threefoldtech/zos/pkg/container/logger"
-	types "github.com/threefoldtech/zos/pkg/gedis/types/provision"
-	"github.com/threefoldtech/zos/pkg/provision"
-	"github.com/threefoldtech/zos/pkg/schema"
-)
-
-// ReservationToSchemaType creates a TfgridReservation1 from zos provision types
-func ReservationToSchemaType(r *provision.Reservation) (types.TfgridReservation1, error) {
-	var res types.TfgridReservation1
-
-	w, err := workloadFromRaw(r.Data, r.Type)
-	if err != nil {
-		return res, err
-	}
-
-	switch r.Type {
-	case provision.ContainerReservation:
-		res.DataReservation.Containers = []types.TfgridReservationContainer1{
-			containerReservation(w, r.NodeID),
-		}
-	case provision.VolumeReservation:
-		res.DataReservation.Volumes = []types.TfgridReservationVolume1{
-			volumeReservation(w, r.NodeID),
-		}
-	case provision.ZDBReservation:
-		res.DataReservation.Zdbs = []types.TfgridReservationZdb1{
-			zdbReservation(w, r.NodeID),
-		}
-	case provision.NetworkReservation:
-		res.DataReservation.Networks = []types.TfgridReservationNetwork1{
-			networkReservation(w),
-		}
-	case provision.KubernetesReservation:
-		res.DataReservation.Kubernetes = []types.TfgridWorkloadsReservationK8S1{
-			k8sReservation(w, r.NodeID),
-		}
-	}
-
-	res.Epoch = schema.Date{Time: r.Created}
-	res.DataReservation.ExpirationReservation = schema.Date{Time: r.Created.Add(r.Duration)}
-	res.DataReservation.ExpirationProvisioning = schema.Date{Time: r.Created.Add(2 * time.Minute)}
-
-	return res, nil
-}
-
-func workloadFromRaw(s json.RawMessage, t provision.ReservationType) (interface{}, error) {
-	switch t {
-	case provision.ContainerReservation:
-		c := provision.Container{}
-		err := json.Unmarshal([]byte(s), &c)
-		return c, err
-
-	case provision.VolumeReservation:
-		v := provision.Volume{}
-		err := json.Unmarshal([]byte(s), &v)
-		return v, err
-
-	case provision.NetworkReservation:
-		n := pkg.Network{}
-		err := json.Unmarshal([]byte(s), &n)
-		return n, err
-
-	case provision.ZDBReservation:
-		z := provision.ZDB{}
-		err := json.Unmarshal([]byte(s), &z)
-		return z, err
-
-	case provision.KubernetesReservation:
-		k := provision.Kubernetes{}
-		err := json.Unmarshal([]byte(s), &k)
-		return k, err
-	}
-
-	return nil, fmt.Errorf("unsupported reservation type %v", t)
-}
-
-func networkReservation(i interface{}) types.TfgridReservationNetwork1 {
-	n := i.(pkg.Network)
-	network := types.TfgridReservationNetwork1{
-		Name:             n.Name,
-		Iprange:          n.IPRange.ToSchema(),
-		WorkloadID:       1,
-		NetworkResources: make([]types.TfgridNetworkNetResource1, len(n.NetResources)),
-	}
-
-	for i, nr := range n.NetResources {
-		network.NetworkResources[i] = types.TfgridNetworkNetResource1{
-			NodeID:                       nr.NodeID,
-			IPRange:                      nr.Subnet.ToSchema(),
-			WireguardPrivateKeyEncrypted: nr.WGPrivateKey,
-			WireguardPublicKey:           nr.WGPublicKey,
-			WireguardListenPort:          int64(nr.WGListenPort),
-			Peers:                        make([]types.WireguardPeer1, len(nr.Peers)),
-		}
-
-		for y, peer := range nr.Peers {
-			network.NetworkResources[i].Peers[y] = types.WireguardPeer1{
-				IPRange:    peer.Subnet.ToSchema(),
-				Endpoint:   peer.Endpoint,
-				PublicKey:  peer.WGPublicKey,
-				AllowedIPs: make([]string, len(peer.AllowedIPs)),
-			}
-
-			for z, ip := range peer.AllowedIPs {
-				network.NetworkResources[i].Peers[y].AllowedIPs[z] = ip.String()
-			}
-		}
-	}
-	return network
-}
-
-func containerReservation(i interface{}, nodeID string) types.TfgridReservationContainer1 {
-	c := i.(provision.Container)
-	container := types.TfgridReservationContainer1{
-		NodeID:            nodeID,
-		WorkloadID:        1,
-		Flist:             c.FList,
-		HubURL:            c.FlistStorage,
-		Environment:       c.Env,
-		SecretEnvironment: c.SecretEnv,
-		Entrypoint:        c.Entrypoint,
-		Interactive:       c.Interactive,
-		Volumes:           make([]types.TfgridReservationContainerMount1, len(c.Mounts)),
-		Logs:              make([]types.TfgridReservationLogs1, len(c.Logs)),
-		NetworkConnection: []types.TfgridReservationNetworkConnection1{
-			{
-				NetworkID: string(c.Network.NetworkID),
-				Ipaddress: c.Network.IPs[0],
-				PublicIP6: c.Network.PublicIP6,
-			},
-		},
-		// StatsAggregator:   c.StatsAggregator,
-		// FarmerTid:         c.FarmerTid,
-	}
-
-	for i, v := range c.Mounts {
-		container.Volumes[i] = types.TfgridReservationContainerMount1{
-			VolumeID:   v.VolumeID,
-			Mountpoint: v.Mountpoint,
-		}
-	}
-
-	for i, v := range c.Logs {
-		// Only allow redis for now
-		if v.Type != logger.RedisType {
-			container.Logs[i] = types.TfgridReservationLogs1{
-				Type: "invalid",
-				Data: types.TfgridReservationLogsRedis1{},
-			}
-
-			continue
-		}
-
-		container.Logs[i] = types.TfgridReservationLogs1{
-			Type: v.Type,
-			Data: types.TfgridReservationLogsRedis1{
-				Stdout: v.Data.Stdout,
-				Stderr: v.Data.Stderr,
-			},
-		}
-	}
-
-	return container
-}
-
-func volumeReservation(i interface{}, nodeID string) types.TfgridReservationVolume1 {
-	v := i.(provision.Volume)
-
-	volume := types.TfgridReservationVolume1{
-		NodeID:     nodeID,
-		WorkloadID: 1,
-		Size:       int64(v.Size),
-	}
-	if v.Type == provision.HDDDiskType {
-		volume.Type = types.TfgridReservationVolume1TypeHDD
-	} else if v.Type == provision.SSDDiskType {
-		volume.Type = types.TfgridReservationVolume1TypeSSD
-	}
-
-	return volume
-}
-
-func zdbReservation(i interface{}, nodeID string) types.TfgridReservationZdb1 {
-	z := i.(provision.ZDB)
-
-	zdb := types.TfgridReservationZdb1{
-		WorkloadID: 1,
-		NodeID:     nodeID,
-		// ReservationID:
-		Size:     int64(z.Size),
-		Password: z.Password,
-		Public:   z.Public,
-		// StatsAggregator:
-		// FarmerTid:
-	}
-	if z.DiskType == pkg.SSDDevice {
-		zdb.DiskType = types.TfgridReservationZdb1DiskTypeHdd
-	} else if z.DiskType == pkg.HDDDevice {
-		zdb.DiskType = types.TfgridReservationZdb1DiskTypeSsd
-	}
-
-	if z.Mode == pkg.ZDBModeUser {
-		zdb.Mode = types.TfgridReservationZdb1ModeUser
-	} else if z.Mode == pkg.ZDBModeSeq {
-		zdb.Mode = types.TfgridReservationZdb1ModeSeq
-	}
-
-	return zdb
-}
-
-func k8sReservation(i interface{}, nodeID string) types.TfgridWorkloadsReservationK8S1 {
-	k := i.(provision.Kubernetes)
-
-	k8s := types.TfgridWorkloadsReservationK8S1{
-		WorkloadID:    1,
-		NodeID:        nodeID,
-		Size:          k.Size,
-		NetworkID:     string(k.NetworkID),
-		Ipaddress:     k.IP,
-		ClusterSecret: k.ClusterSecret,
-		MasterIps:     make([]net.IP, len(k.MasterIPs)),
-		SSHKeys:       make([]string, len(k.SSHKeys)),
-	}
-
-	copy(k8s.MasterIps, k.MasterIPs)
-	copy(k8s.SSHKeys, k.SSHKeys)
-
-	return k8s
-}
diff --git a/pkg/gedis/types/directory/tfgrid_farm_1.go b/pkg/gedis/types/directory/tfgrid_farm_1.go
deleted file mode 100644
index e878eec4..00000000
--- a/pkg/gedis/types/directory/tfgrid_farm_1.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package directory
-
-//TfgridFarm1 jsx schema
-type TfgridFarm1 struct {
-	ID              uint64                     `json:"id"`
-	ThreebotID      uint64                     `json:"threebot_id"`
-	IyoOrganization string                     `json:"iyo_organization"`
-	Name            string                     `json:"name"`
-	WalletAddresses []string                   `json:"wallet_addresses"`
-	Location        TfgridLocation1            `json:"location"`
-	Email           string                     `json:"email"`
-	ResourcePrices  []TfgridNodeResourcePrice1 `json:"resource_prices"`
-}
-
-//TfgridNodeResourcePrice1 jsx schema
-type TfgridNodeResourcePrice1 struct {
-	Currency TfgridNodeResourcePrice1CurrencyEnum `json:"currency"`
-	Cru      float64                              `json:"cru"`
-	Mru      float64                              `json:"mru"`
-	Hru      float64                              `json:"hru"`
-	Sru      float64                              `json:"sru"`
-	Nru      float64                              `json:"nru"`
-}
-
-//TfgridNodeResourcePrice1CurrencyEnum jsx schema
-type TfgridNodeResourcePrice1CurrencyEnum uint8
-
-// TfgridNodeResourcePrice1CurrencyEnum jsx schema
-const (
-	TfgridNodeResourcePrice1CurrencyEUR TfgridNodeResourcePrice1CurrencyEnum = iota
-	TfgridNodeResourcePrice1CurrencyUSD
-	TfgridNodeResourcePrice1CurrencyTFT
-	TfgridNodeResourcePrice1CurrencyAED
-	TfgridNodeResourcePrice1CurrencyGBP
-)
-
-// String implement stringer interface
-func (e TfgridNodeResourcePrice1CurrencyEnum) String() string {
-	switch e {
-	case TfgridNodeResourcePrice1CurrencyEUR:
-		return "EUR"
-	case TfgridNodeResourcePrice1CurrencyUSD:
-		return "USD"
-	case TfgridNodeResourcePrice1CurrencyTFT:
-		return "TFT"
-	case TfgridNodeResourcePrice1CurrencyAED:
-		return "AED"
-	case TfgridNodeResourcePrice1CurrencyGBP:
-		return "GBP"
-	}
-	return "UNKNOWN"
-}
diff --git a/pkg/gedis/types/directory/tfgrid_farmer_1.go b/pkg/gedis/types/directory/tfgrid_farmer_1.go
deleted file mode 100644
index c7428171..00000000
--- a/pkg/gedis/types/directory/tfgrid_farmer_1.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package directory
-
-// TfgridFarmer1 jsx schema
-type TfgridFarmer1 struct {
-	OwnerThreebotID string   `json:"owner_threebot_id"`
-	IyoOrganization string   `json:"iyo_organization"`
-	Name            string   `json:"name"`
-	WalletAddresses []string `json:"wallet_addresses"`
-	Email           string   `json:"email"`
-}
diff --git a/pkg/gedis/types/directory/tfgrid_location_1.go b/pkg/gedis/types/directory/tfgrid_location_1.go
deleted file mode 100644
index ecf4f3d8..00000000
--- a/pkg/gedis/types/directory/tfgrid_location_1.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package directory
-
-//TfgridLocation1 jsx schema
-type TfgridLocation1 struct {
-	City      string  `json:"city"`
-	Country   string  `json:"country"`
-	Continent string  `json:"continent"`
-	Latitude  float64 `json:"latitude"`
-	Longitude float64 `json:"longitude"`
-}
diff --git a/pkg/gedis/types/directory/tfgrid_node_2.go b/pkg/gedis/types/directory/tfgrid_node_2.go
deleted file mode 100644
index 26ab5bc3..00000000
--- a/pkg/gedis/types/directory/tfgrid_node_2.go
+++ /dev/null
@@ -1,91 +0,0 @@
-package directory
-
-import (
-	"net"
-
-	schema "github.com/threefoldtech/zos/pkg/schema"
-)
-
-//TfgridNode2 jsx schema
-type TfgridNode2 struct {
-	NodeID            string                    `json:"node_id"`
-	NodeIDv1          string                    `json:"node_id_v1"`
-	FarmID            uint64                    `json:"farm_id"`
-	OsVersion         string                    `json:"os_version"`
-	Created           schema.Date               `json:"created"`
-	Updated           schema.Date               `json:"updated"`
-	Uptime            int64                     `json:"uptime"`
-	Address           string                    `json:"address"`
-	Location          TfgridLocation1           `json:"location"`
-	TotalResources    TfgridNodeResourceAmount1 `json:"total_resources"`
-	UsedResources     TfgridNodeResourceAmount1 `json:"used_resources"`
-	ReservedResources TfgridNodeResourceAmount1 `json:"reserved_resources"`
-	Proofs            []TfgridNodeProof1        `json:"proofs"`
-	Ifaces            []TfgridNodeIface1        `json:"ifaces"`
-	PublicConfig      *TfgridNodePublicIface1   `json:"public_config,omitempty"`
-	WGPorts           []uint                    `json:"wg_ports"`
-	Approved          bool                      `json:"approved"`
-	PublicKeyHex      string                    `json:"public_key_hex"`
-}
-
-// TfgridNodeIface1 jsx schema
-type TfgridNodeIface1 struct {
-	Name       string            `json:"name"`
-	Addrs      []schema.IPRange  `json:"addrs"`
-	Gateway    []net.IP          `json:"gateway"`
-	MacAddress schema.MacAddress `json:"macaddress"`
-}
-
-// TfgridNodePublicIface1 jsx schema
-type TfgridNodePublicIface1 struct {
-	Master  string                         `json:"master"`
-	Type    TfgridNodePublicIface1TypeEnum `json:"type"`
-	Ipv4    schema.IPRange                 `json:"ipv4"`
-	Ipv6    schema.IPRange                 `json:"ipv6"`
-	Gw4     net.IP                         `json:"gw4"`
-	Gw6     net.IP                         `json:"gw6"`
-	Version int64                          `json:"version"`
-}
-
-// TfgridNodeResourceAmount1 jsx schema
-type TfgridNodeResourceAmount1 struct {
-	Cru int64 `json:"cru"`
-	Mru int64 `json:"mru"`
-	Hru int64 `json:"hru"`
-	Sru int64 `json:"sru"`
-}
-
-// TfgridNodeProof1 jsx schema
-type TfgridNodeProof1 struct {
-	Created      schema.Date            `json:"created"`
-	HardwareHash string                 `json:"hardware_hash"`
-	DiskHash     string                 `json:"disk_hash"`
-	Hardware     map[string]interface{} `json:"hardware"`
-	Disks        map[string]interface{} `json:"disks"`
-	Hypervisor   []string               `json:"hypervisor"`
-}
-
-// Equal test of 2 proofs have the same hashes
-func (p TfgridNodeProof1) Equal(proof TfgridNodeProof1) bool {
-	return p.DiskHash == proof.DiskHash && p.HardwareHash == proof.HardwareHash
-}
-
-// TfgridNodePublicIface1TypeEnum jsx schema
-type TfgridNodePublicIface1TypeEnum uint8
-
-// TfgridNodePublicIface1TypeEnum
-const (
-	TfgridNodePublicIface1TypeMacvlan TfgridNodePublicIface1TypeEnum = iota
-	TfgridNodePublicIface1TypeVlan
-)
-
-// String implements stringer interface
-func (e TfgridNodePublicIface1TypeEnum) String() string {
-	switch e {
-	case TfgridNodePublicIface1TypeMacvlan:
-		return "macvlan"
-	case TfgridNodePublicIface1TypeVlan:
-		return "vlan"
-	}
-	return "UNKNOWN"
-}
diff --git a/pkg/gedis/types/provision/tfgrid_reservation_1.go b/pkg/gedis/types/provision/tfgrid_reservation_1.go
deleted file mode 100644
index 78bf3a38..00000000
--- a/pkg/gedis/types/provision/tfgrid_reservation_1.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package provision
-
-import (
-	schema "github.com/threefoldtech/zos/pkg/schema"
-)
-
-// TfgridReservation1 jsx schema
-type TfgridReservation1 struct {
-	ID                  uint                                 `json:"id"`
-	JSON                string                               `json:"json"`
-	DataReservation     TfgridReservationData1               `json:"data_reservation"`
-	CustomerTid         int64                                `json:"customer_tid"`
-	CustomerSignature   string                               `json:"customer_signature"`
-	NextAction          TfgridReservation1NextActionEnum     `json:"next_action"`
-	SignaturesProvision []TfgridReservationSigningSignature1 `json:"signatures_provision"`
-	SignaturesFarmer    []TfgridReservationSigningSignature1 `json:"signatures_farmer"`
-	SignaturesDelete    []TfgridReservationSigningSignature1 `json:"signatures_delete"`
-	Epoch               schema.Date                          `json:"epoch"`
-	Results             []TfgridReservationResult1           `json:"results"`
-}
-
-// TfgridReservationData1 jsx schema
-type TfgridReservationData1 struct {
-	Description             string                           `json:"description"`
-	SigningRequestProvision TfgridReservationSigningRequest1 `json:"signing_request_provision"`
-	SigningRequestDelete    TfgridReservationSigningRequest1 `json:"signing_request_delete"`
-	Containers              []TfgridReservationContainer1    `json:"containers"`
-	Volumes                 []TfgridReservationVolume1       `json:"volumes"`
-	Zdbs                    []TfgridReservationZdb1          `json:"zdbs"`
-	Networks                []TfgridReservationNetwork1      `json:"networks"`
-	Kubernetes              []TfgridWorkloadsReservationK8S1 `json:"kubernetes"`
-	ExpirationProvisioning  schema.Date                      `json:"expiration_provisioning"`
-	ExpirationReservation   schema.Date                      `json:"expiration_reservation"`
-}
-
-// TfgridReservationSigningRequest1 jsx schema
-type TfgridReservationSigningRequest1 struct {
-	Signers   []int64 `json:"signers"`
-	QuorumMin int64   `json:"quorum_min"`
-}
-
-//TfgridReservationSigningSignature1 jsx schema
-type TfgridReservationSigningSignature1 struct {
-	Tid       int64       `json:"tid"`
-	Signature string      `json:"signature"`
-	Epoch     schema.Date `json:"epoch"`
-}
-
-//TfgridReservation1NextActionEnum jsx schema
-type TfgridReservation1NextActionEnum uint8
-
-// TfgridReservation1NextActionEnum enum
-const (
-	TfgridReservation1NextActionCreate TfgridReservation1NextActionEnum = iota
-	TfgridReservation1NextActionSign
-	TfgridReservation1NextActionPay
-	TfgridReservation1NextActionDeploy
-	TfgridReservation1NextActionDelete
-	TfgridReservation1NextActionInvalid
-	TfgridReservation1NextActionDeleted
-)
-
-func (e TfgridReservation1NextActionEnum) String() string {
-	switch e {
-	case TfgridReservation1NextActionCreate:
-		return "create"
-	case TfgridReservation1NextActionSign:
-		return "sign"
-	case TfgridReservation1NextActionPay:
-		return "pay"
-	case TfgridReservation1NextActionDeploy:
-		return "deploy"
-	case TfgridReservation1NextActionDelete:
-		return "delete"
-	case TfgridReservation1NextActionInvalid:
-		return "invalid"
-	case TfgridReservation1NextActionDeleted:
-		return "deleted"
-	}
-	return "UNKNOWN"
-}
diff --git a/pkg/gedis/types/provision/tfgrid_reservation_container_1.go b/pkg/gedis/types/provision/tfgrid_reservation_container_1.go
deleted file mode 100644
index 06be3005..00000000
--- a/pkg/gedis/types/provision/tfgrid_reservation_container_1.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package provision
-
-import (
-	"net"
-)
-
-//TfgridReservationContainer1 jsx schema
-type TfgridReservationContainer1 struct {
-	WorkloadID        int64                                 `json:"workload_id"`
-	NodeID            string                                `json:"node_id"`
-	Flist             string                                `json:"flist"`
-	HubURL            string                                `json:"hub_url"`
-	Environment       map[string]string                     `json:"environment"`
-	SecretEnvironment map[string]string                     `json:"secret_environment"`
-	Entrypoint        string                                `json:"entrypoint"`
-	Interactive       bool                                  `json:"interactive"`
-	Volumes           []TfgridReservationContainerMount1    `json:"volumes"`
-	NetworkConnection []TfgridReservationNetworkConnection1 `json:"network_connection"`
-	StatsAggregator   []TfgridReservationStatsaggregator1   `json:"stats_aggregator"`
-	Logs              []TfgridReservationLogs1              `json:"logs"`
-}
-
-//TfgridReservationContainerMount1 jsx schema
-type TfgridReservationContainerMount1 struct {
-	VolumeID   string `json:"volume_id"`
-	Mountpoint string `json:"mountpoint"`
-}
-
-//TfgridReservationNetworkConnection1 jsx schema
-type TfgridReservationNetworkConnection1 struct {
-	NetworkID string `json:"network_id"`
-	Ipaddress net.IP `json:"ipaddress"`
-	PublicIP6 bool   `json:"public_ip6"`
-}
-
-//TfgridReservationLogs1 user defined log description
-type TfgridReservationLogs1 struct {
-	Type string                      `json:"type"`
-	Data TfgridReservationLogsRedis1 `json:"data"`
-}
-
-//TfgridReservationLogsRedis1 redis log backend
-type TfgridReservationLogsRedis1 struct {
-	Stdout string `json:"stdout"`
-	Stderr string `json:"stderr"`
-}
diff --git a/pkg/gedis/types/provision/tfgrid_reservation_network_1.go b/pkg/gedis/types/provision/tfgrid_reservation_network_1.go
deleted file mode 100644
index 23a745ff..00000000
--- a/pkg/gedis/types/provision/tfgrid_reservation_network_1.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package provision
-
-import (
-	schema "github.com/threefoldtech/zos/pkg/schema"
-)
-
-// TfgridReservationNetwork1 jsx Schema
-type TfgridReservationNetwork1 struct {
-	Name             string                              `json:"name"`
-	WorkloadID       int64                               `json:"workload_id"`
-	Iprange          schema.IPRange                      `json:"iprange"`
-	StatsAggregator  []TfgridReservationStatsaggregator1 `json:"stats_aggregator"`
-	NetworkResources []TfgridNetworkNetResource1         `json:"network_resources"`
-}
-
-// TfgridNetworkNetResource1 jsx Schema
-type TfgridNetworkNetResource1 struct {
-	NodeID                       string           `json:"node_id"`
-	IPRange                      schema.IPRange   `json:"iprange"`
-	WireguardPrivateKeyEncrypted string           `json:"wireguard_private_key_encrypted"`
-	WireguardPublicKey           string           `json:"wireguard_public_key"`
-	WireguardListenPort          int64            `json:"wireguard_listen_port"`
-	Peers                        []WireguardPeer1 `json:"peers"`
-}
-
-// WireguardPeer1 jsx Schema
-type WireguardPeer1 struct {
-	PublicKey  string         `json:"public_key"`
-	Endpoint   string         `json:"endpoint"`
-	AllowedIPs []string       `json:"allowed_iprange"`
-	IPRange    schema.IPRange `json:"iprange"`
-}
diff --git a/pkg/gedis/types/provision/tfgrid_reservation_statsaggregator_1.go b/pkg/gedis/types/provision/tfgrid_reservation_statsaggregator_1.go
deleted file mode 100644
index 44f98200..00000000
--- a/pkg/gedis/types/provision/tfgrid_reservation_statsaggregator_1.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package provision
-
-import (
-	"encoding/json"
-
-	schema "github.com/threefoldtech/zos/pkg/schema"
-)
-
-//TfgridReservationStatsaggregator1 jsx schema
-type TfgridReservationStatsaggregator1 struct {
-	Addr   string `json:"addr"`
-	Port   int64  `json:"port"`
-	Secret string `json:"secret"`
-}
-
-//TfgridReservationResult1 jsx schema
-type TfgridReservationResult1 struct {
-	Category   TfgridReservationResult1CategoryEnum `json:"category"`
-	WorkloadID string                               `json:"workload_id"`
-	DataJSON   json.RawMessage                      `json:"data_json"`
-	Signature  string                               `json:"signature"`
-	State      TfgridReservationResult1StateEnum    `json:"state"`
-	Message    string                               `json:"message"`
-	Epoch      schema.Date                          `json:"epoch"`
-}
-
-//TfgridReservationResult1CategoryEnum jsx schema
-type TfgridReservationResult1CategoryEnum uint8
-
-//TfgridReservationResult1CategoryEnum
-const (
-	TfgridReservationResult1CategoryZdb TfgridReservationResult1CategoryEnum = iota
-	TfgridReservationResult1CategoryContainer
-	TfgridReservationResult1CategoryNetwork
-	TfgridReservationResult1CategoryVolume
-)
-
-//String implements Stringer interface
-func (e TfgridReservationResult1CategoryEnum) String() string {
-	switch e {
-	case TfgridReservationResult1CategoryZdb:
-		return "zdb"
-	case TfgridReservationResult1CategoryContainer:
-		return "container"
-	case TfgridReservationResult1CategoryNetwork:
-		return "network"
-	case TfgridReservationResult1CategoryVolume:
-		return "volume"
-	}
-	return "UNKNOWN"
-}
-
-//TfgridReservationResult1StateEnum jsx schema
-type TfgridReservationResult1StateEnum uint8
-
-//TfgridReservationResult1StateEnum
-const (
-	TfgridReservationResult1StateError TfgridReservationResult1StateEnum = iota
-	TfgridReservationResult1StateOk
-	TfgridReservationResult1StateDeleted
-)
-
-func (e TfgridReservationResult1StateEnum) String() string {
-	switch e {
-	case TfgridReservationResult1StateError:
-		return "error"
-	case TfgridReservationResult1StateOk:
-		return "ok"
-	case TfgridReservationResult1StateDeleted:
-		return "deleted"
-	}
-	return "UNKNOWN"
-}
diff --git a/pkg/gedis/types/provision/tfgrid_reservation_volume_1.go b/pkg/gedis/types/provision/tfgrid_reservation_volume_1.go
deleted file mode 100644
index e7813b6a..00000000
--- a/pkg/gedis/types/provision/tfgrid_reservation_volume_1.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package provision
-
-//TfgridReservationVolume1 jsx schema
-type TfgridReservationVolume1 struct {
-	WorkloadID      int64                               `json:"workload_id"`
-	NodeID          string                              `json:"node_id"`
-	Size            int64                               `json:"size"`
-	Type            TfgridReservationVolume1TypeEnum    `json:"type"`
-	StatsAggregator []TfgridReservationStatsaggregator1 `json:"stats_aggregator"`
-}
-
-//TfgridReservationVolume1TypeEnum jsx schema
-type TfgridReservationVolume1TypeEnum uint8
-
-//TfgridReservationVolume1TypeEnum
-const (
-	TfgridReservationVolume1TypeHDD TfgridReservationVolume1TypeEnum = iota
-	TfgridReservationVolume1TypeSSD
-)
-
-// String implements Stringer interface
-func (e TfgridReservationVolume1TypeEnum) String() string {
-	switch e {
-	case TfgridReservationVolume1TypeHDD:
-		return "HDD"
-	case TfgridReservationVolume1TypeSSD:
-		return "SSD"
-	}
-	return "UNKNOWN"
-}
diff --git a/pkg/gedis/types/provision/tfgrid_reservation_workload_1.go b/pkg/gedis/types/provision/tfgrid_reservation_workload_1.go
deleted file mode 100644
index 4cd7d8b0..00000000
--- a/pkg/gedis/types/provision/tfgrid_reservation_workload_1.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package provision
-
-import (
-	"encoding/json"
-
-	"github.com/threefoldtech/zos/pkg/schema"
-)
-
-//TfgridReservationWorkload1 jsx schema
-type TfgridReservationWorkload1 struct {
-	WorkloadID string                             `json:"workload_id,omitempty"`
-	Type       TfgridReservationWorkload1TypeEnum `json:"type,omitempty"`
-	Workload   json.RawMessage                    `json:"content,omitempty"`
-	User       string                             `json:"user,omitempty"`
-	Created    schema.Date                        `json:"created,omitempty"`
-	Duration   int64                              `json:"duration,omitempty"`
-	Signature  string                             `json:"signature,omitempty"`
-	ToDelete   bool                               `json:"to_delete,omitempty"`
-}
-
-//TfgridReservationWorkload1TypeEnum jsx schema
-type TfgridReservationWorkload1TypeEnum uint8
-
-// TfgridReservationWorkload1TypeEnum
-const (
-	TfgridReservationWorkload1TypeZdb TfgridReservationWorkload1TypeEnum = iota
-	TfgridReservationWorkload1TypeContainer
-	TfgridReservationWorkload1TypeVolume
-	TfgridReservationWorkload1TypeNetwork
-	TfgridReservationWorkload1TypeKubernetes
-)
-
-// String implements Stringer interface
-func (e TfgridReservationWorkload1TypeEnum) String() string {
-	switch e {
-	case TfgridReservationWorkload1TypeNetwork:
-		return "network"
-	case TfgridReservationWorkload1TypeVolume:
-		return "volume"
-	case TfgridReservationWorkload1TypeZdb:
-		return "zdb"
-	case TfgridReservationWorkload1TypeContainer:
-		return "container"
-	case TfgridReservationWorkload1TypeKubernetes:
-		return "kubernetes"
-	}
-	return "UNKNOWN"
-}
diff --git a/pkg/gedis/types/provision/tfgrid_reservation_zdb_1.go b/pkg/gedis/types/provision/tfgrid_reservation_zdb_1.go
deleted file mode 100644
index bdd37326..00000000
--- a/pkg/gedis/types/provision/tfgrid_reservation_zdb_1.go
+++ /dev/null
@@ -1,53 +0,0 @@
-package provision
-
-//TfgridReservationZdb1 jsx schema
-type TfgridReservationZdb1 struct {
-	WorkloadID      int64                               `json:"workload_id"`
-	NodeID          string                              `json:"node_id"`
-	ReservationID   int64                               `json:"reservation_id"`
-	Size            int64                               `json:"size"`
-	Mode            TfgridReservationZdb1ModeEnum       `json:"mode"`
-	Password        string                              `json:"password"`
-	DiskType        TfgridReservationZdb1DiskTypeEnum   `json:"disk_type"`
-	Public          bool                                `json:"public"`
-	StatsAggregator []TfgridReservationStatsaggregator1 `json:"stats_aggregator"`
-}
-
-//TfgridReservationZdb1ModeEnum jsx schema
-type TfgridReservationZdb1ModeEnum uint8
-
-// TfgridReservationZdb1ModeEnum
-const (
-	TfgridReservationZdb1ModeSeq TfgridReservationZdb1ModeEnum = iota
-	TfgridReservationZdb1ModeUser
-)
-
-func (e TfgridReservationZdb1ModeEnum) String() string {
-	switch e {
-	case TfgridReservationZdb1ModeSeq:
-		return "seq"
-	case TfgridReservationZdb1ModeUser:
-		return "user"
-	}
-	return "UNKNOWN"
-}
-
-//TfgridReservationZdb1DiskTypeEnum jsx schema
-type TfgridReservationZdb1DiskTypeEnum uint8
-
-//TfgridReservationZdb1DiskTypeEnum
-const (
-	TfgridReservationZdb1DiskTypeHdd TfgridReservationZdb1DiskTypeEnum = iota
-	TfgridReservationZdb1DiskTypeSsd
-)
-
-//String implement Stringer interface
-func (e TfgridReservationZdb1DiskTypeEnum) String() string {
-	switch e {
-	case TfgridReservationZdb1DiskTypeHdd:
-		return "hdd"
-	case TfgridReservationZdb1DiskTypeSsd:
-		return "ssd"
-	}
-	return "UNKNOWN"
-}
diff --git a/pkg/gedis/types/provision/tfgrid_workloads_reservation_k8s.go b/pkg/gedis/types/provision/tfgrid_workloads_reservation_k8s.go
deleted file mode 100644
index ecc96b14..00000000
--- a/pkg/gedis/types/provision/tfgrid_workloads_reservation_k8s.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package provision
-
-import (
-	"net"
-)
-
-// TfgridWorkloadsReservationK8S1 struct
-type TfgridWorkloadsReservationK8S1 struct {
-	WorkloadID      int64                               `json:"workload_id"`
-	NodeID          string                              `json:"node_id"`
-	Size            uint8                               `json:"size"`
-	NetworkID       string                              `json:"network_id"`
-	Ipaddress       net.IP                              `json:"ipaddress"`
-	ClusterSecret   string                              `json:"cluster_secret"`
-	MasterIps       []net.IP                            `json:"master_ips"`
-	SSHKeys         []string                            `json:"ssh_keys"`
-	StatsAggregator []TfgridReservationStatsaggregator1 `json:"stats_aggregator"`
-	FarmerTid       int64                               `json:"farmer_tid"`
-}
diff --git a/pkg/identity/store.go b/pkg/identity/store.go
deleted file mode 100644
index 4775078f..00000000
--- a/pkg/identity/store.go
+++ /dev/null
@@ -1,107 +0,0 @@
-package identity
-
-import (
-	"bytes"
-	"encoding/hex"
-	"encoding/json"
-	"fmt"
-	"io/ioutil"
-	"net/http"
-
-	"github.com/jbenet/go-base58"
-
-	"github.com/threefoldtech/zos/pkg/gedis/types/directory"
-
-	"github.com/threefoldtech/zos/pkg/geoip"
-
-	"github.com/threefoldtech/zos/pkg"
-)
-
-// IDStore is the interface defining the
-// client side of an identity store
-type IDStore interface {
-	RegisterNode(node pkg.Identifier, farm pkg.FarmID, version string, loc geoip.Location) (string, error)
-	RegisterFarm(tid uint64, name string, email string, wallet []string) (pkg.FarmID, error)
-}
-
-type httpIDStore struct {
-	baseURL string
-}
-
-// NewHTTPIDStore returns a HTTP IDStore client
-func NewHTTPIDStore(url string) IDStore {
-	return &httpIDStore{baseURL: url}
-}
-
-// RegisterNode implements the IDStore interface
-func (s *httpIDStore) RegisterNode(node pkg.Identifier, farm pkg.FarmID, version string, loc geoip.Location) (string, error) {
-	buf := bytes.Buffer{}
-
-	pk := base58.Decode(node.Identity())
-
-	err := json.NewEncoder(&buf).Encode(directory.TfgridNode2{
-		NodeID:    node.Identity(),
-		FarmID:    uint64(farm),
-		OsVersion: version,
-		Location: directory.TfgridLocation1{
-			City:      loc.City,
-			Country:   loc.Country,
-			Continent: loc.Continent,
-			Latitude:  loc.Latitude,
-			Longitude: loc.Longitute,
-		},
-		PublicKeyHex: hex.EncodeToString(pk),
-	})
-	if err != nil {
-		return "", err
-	}
-
-	resp, err := http.Post(s.baseURL+"/nodes", "application/json", &buf)
-	if err != nil {
-		return "", err
-	}
-	defer resp.Body.Close()
-
-	if resp.StatusCode != http.StatusCreated {
-		return "", fmt.Errorf("wrong response status code received: %v", resp.Status)
-	}
-
-	return "(unknown)", nil
-}
-
-// RegisterFarm implements the IDStore interface
-func (s *httpIDStore) RegisterFarm(tid uint64, name string, email string, wallet []string) (pkg.FarmID, error) {
-	buf := bytes.Buffer{}
-	err := json.NewEncoder(&buf).Encode(directory.TfgridFarm1{
-		ThreebotID:      tid,
-		Name:            name,
-		Email:           email,
-		WalletAddresses: wallet,
-	})
-	if err != nil {
-		return 0, err
-	}
-
-	resp, err := http.Post(s.baseURL+"/farms", "application/json", &buf)
-	if err != nil {
-		return 0, err
-	}
-	defer func() {
-		ioutil.ReadAll(resp.Body)
-		resp.Body.Close()
-	}()
-
-	if resp.StatusCode != http.StatusCreated {
-		msg, _ := ioutil.ReadAll(resp.Body)
-		return 0, fmt.Errorf("wrong response status code received: (%s) %s", string(msg), resp.Status)
-	}
-
-	id := struct {
-		ID pkg.FarmID `json:"id"`
-	}{}
-	if err := json.NewDecoder(resp.Body).Decode(&id); err != nil {
-		return 0, err
-	}
-
-	return id.ID, nil
-}
diff --git a/pkg/network/networker.go b/pkg/network/networker.go
index f33ec23b..f2a945cb 100644
--- a/pkg/network/networker.go
+++ b/pkg/network/networker.go
@@ -16,6 +16,7 @@ import (
 	"github.com/threefoldtech/zos/pkg/cache"
 	"github.com/threefoldtech/zos/pkg/network/ndmz"
 	"github.com/threefoldtech/zos/pkg/network/tuntap"
+	"github.com/threefoldtech/zos/tools/client"
 
 	"github.com/containernetworking/plugins/pkg/ns"
 	"github.com/vishvananda/netlink"
@@ -54,12 +55,12 @@ type networker struct {
 	identity     pkg.IdentityManager
 	networkDir   string
 	ipamLeaseDir string
-	tnodb        TNoDB
+	tnodb        client.Directory
 	portSet      *set.UintSet
 }
 
 // NewNetworker create a new pkg.Networker that can be used over zbus
-func NewNetworker(identity pkg.IdentityManager, tnodb TNoDB, storageDir string) (pkg.Networker, error) {
+func NewNetworker(identity pkg.IdentityManager, tnodb client.Directory, storageDir string) (pkg.Networker, error) {
 
 	vd, err := cache.VolatileDir("networkd", 50*mib)
 	if err != nil && !os.IsExist(err) {
@@ -685,7 +686,7 @@ func (n *networker) publishWGPorts() error {
 		return err
 	}
 
-	if err := n.tnodb.PublishWGPort(n.identity.NodeID(), ports); err != nil {
+	if err := n.tnodb.NodeSetPorts(n.identity.NodeID().Identity(), ports); err != nil {
 		// maybe retry a couple of times ?
 		// having bdb and the node out of sync is pretty bad
 		return errors.Wrap(err, "fail to publish wireguard port to bcdb")
diff --git a/pkg/network/tnodb.go b/pkg/network/tnodb.go
deleted file mode 100644
index 54baf10f..00000000
--- a/pkg/network/tnodb.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package network
-
-import (
-	"errors"
-
-	"github.com/threefoldtech/zos/pkg"
-	"github.com/threefoldtech/zos/pkg/network/types"
-)
-
-// TNoDB define the interface to implement
-// to talk to a Tenant Network object database
-type TNoDB interface {
-	GetFarm(farm pkg.Identifier) (*Farm, error)
-
-	PublishInterfaces(node pkg.Identifier, ifaces []types.IfaceInfo) error
-	GetNode(pkg.Identifier) (*types.Node, error)
-	PublishWGPort(node pkg.Identifier, ports []uint) error
-
-	SetPublicIface(node pkg.Identifier, pub *types.PubIface) error
-	GetPubIface(node pkg.Identifier) (*types.PubIface, error)
-}
-
-// Farm hold the ID, name and list of possible exit node of a farm
-type Farm struct {
-	ID        string   `json:"farm_id"`
-	Name      string   `json:"name"`
-	ExitNodes []string `json:"exit_nodes"`
-}
-
-// ErrNoPubIface is the error returns by ReadPubIface when no public
-// interface is configured
-var ErrNoPubIface = errors.New("no public interface configured for this node")
diff --git a/pkg/network/tnodb/doc.go b/pkg/network/tnodb/doc.go
deleted file mode 100644
index 2b6d624d..00000000
--- a/pkg/network/tnodb/doc.go
+++ /dev/null
@@ -1,2 +0,0 @@
-// Package tnodb expose the interface required to talk to a Tenant network object database (TNODB)
-package tnodb
diff --git a/pkg/network/tnodb/store.go b/pkg/network/tnodb/store.go
deleted file mode 100644
index a34252ea..00000000
--- a/pkg/network/tnodb/store.go
+++ /dev/null
@@ -1,296 +0,0 @@
-package tnodb
-
-import (
-	"bytes"
-	"encoding/json"
-	"fmt"
-	"net"
-	"net/http"
-	"net/http/httputil"
-
-	"github.com/pkg/errors"
-	"github.com/threefoldtech/zos/pkg"
-	"github.com/threefoldtech/zos/pkg/network"
-
-	"github.com/threefoldtech/zos/pkg/gedis/types/directory"
-	"github.com/threefoldtech/zos/pkg/network/types"
-)
-
-type httpTNoDB struct {
-	baseURL string
-}
-
-// NewHTTPTNoDB create an a client to a TNoDB reachable over HTTP
-func NewHTTPTNoDB(url string) network.TNoDB {
-	return &httpTNoDB{baseURL: url}
-}
-
-func (s *httpTNoDB) RegisterAllocation(farm pkg.Identifier, allocation *net.IPNet) error {
-	req := struct {
-		FarmerID string `json:"farmer_id"`
-		Alloc    string `json:"allocation"`
-	}{
-		FarmerID: farm.Identity(),
-		Alloc:    allocation.String(),
-	}
-	buf := bytes.Buffer{}
-	err := json.NewEncoder(&buf).Encode(req)
-	if err != nil {
-		return err
-	}
-
-	resp, err := http.Post(s.baseURL+"/allocations", "application/json", &buf)
-	if err != nil {
-		return err
-	}
-	defer resp.Body.Close()
-
-	if resp.StatusCode != http.StatusCreated {
-		b, err := httputil.DumpResponse(resp, true)
-		if err != nil {
-			panic(err)
-		}
-		fmt.Printf("%+v", string(b))
-		return fmt.Errorf("wrong response status code received: %v", resp.Status)
-	}
-
-	return nil
-}
-
-func (s *httpTNoDB) RequestAllocation(farm pkg.Identifier) (*net.IPNet, *net.IPNet, uint8, error) {
-	url := fmt.Sprintf("%s/%s/%s", s.baseURL, "allocations", farm.Identity())
-	resp, err := http.Get(url)
-	if err != nil {
-		return nil, nil, 0, err
-	}
-	defer resp.Body.Close()
-
-	if resp.StatusCode != http.StatusOK {
-		b, err := httputil.DumpResponse(resp, true)
-		if err != nil {
-			panic(err)
-		}
-		fmt.Printf("%+v", string(b))
-		return nil, nil, 0, fmt.Errorf("wrong response status code received: %v", resp.Status)
-	}
-
-	data := struct {
-		Alloc      string `json:"allocation"`
-		FarmAlloc  string `json:"farm_alloc"`
-		ExitNodeNr uint8  `json:"exit_node_nr"`
-	}{}
-	if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
-		return nil, nil, 0, err
-	}
-
-	_, alloc, err := net.ParseCIDR(data.Alloc)
-	if err != nil {
-		return nil, nil, 0, errors.Wrap(err, "failed to parse network allocation")
-	}
-	_, farmAlloc, err := net.ParseCIDR(data.FarmAlloc)
-	if err != nil {
-		return nil, nil, 0, errors.Wrap(err, "failed to parse farm allocation")
-	}
-
-	return alloc, farmAlloc, data.ExitNodeNr, nil
-}
-
-func (s *httpTNoDB) GetFarm(farm pkg.Identifier) (*network.Farm, error) {
-	var f network.Farm
-
-	url := fmt.Sprintf("%s/farms/%s", s.baseURL, farm.Identity())
-	resp, err := http.Get(url)
-	if err != nil {
-		return nil, err
-	}
-	defer resp.Body.Close()
-
-	err = json.NewDecoder(resp.Body).Decode(&f)
-
-	return &f, err
-}
-
-func (s *httpTNoDB) GetNode(nodeID pkg.Identifier) (*types.Node, error) {
-
-	url := fmt.Sprintf("%s/nodes/%s", s.baseURL, nodeID.Identity())
-
-	resp, err := http.Get(url)
-	if err != nil {
-		return nil, err
-	}
-	defer resp.Body.Close()
-
-	if resp.StatusCode == http.StatusNotFound {
-		return nil, fmt.Errorf("node %s not found", nodeID.Identity())
-	}
-
-	if resp.StatusCode != http.StatusOK {
-		return nil, fmt.Errorf("wrong response status: %v", resp.Status)
-	}
-
-	node := directory.TfgridNode2{}
-	if err := json.NewDecoder(resp.Body).Decode(&node); err != nil {
-		return nil, err
-	}
-
-	return types.NewNodeFromSchema(node), nil
-}
-
-func (s *httpTNoDB) PublishInterfaces(local pkg.Identifier, ifaces []types.IfaceInfo) error {
-	url := fmt.Sprintf("%s/nodes/%s/interfaces", s.baseURL, local.Identity())
-	buf := &bytes.Buffer{}
-	if err := json.NewEncoder(buf).Encode(ifaces); err != nil {
-		return err
-	}
-
-	resp, err := http.Post(url, "application/json", buf)
-	if err != nil {
-		return err
-	}
-
-	defer resp.Body.Close()
-	if resp.StatusCode != http.StatusCreated {
-		return fmt.Errorf("wrong response status received: %s", resp.Status)
-	}
-
-	return nil
-}
-
-func (s *httpTNoDB) PublishWGPort(nodeID pkg.Identifier, ports []uint) error {
-	url := fmt.Sprintf("%s/nodes/%s/ports", s.baseURL, nodeID.Identity())
-
-	output := struct {
-		Ports []uint `json:"ports"`
-	}{
-		Ports: ports,
-	}
-	buf := &bytes.Buffer{}
-	if err := json.NewEncoder(buf).Encode(output); err != nil {
-		return err
-	}
-
-	resp, err := http.Post(url, "application/json", buf)
-	if err != nil {
-		return err
-	}
-
-	defer resp.Body.Close()
-	if resp.StatusCode != http.StatusOK {
-		return fmt.Errorf("wrong response status received: %s", resp.Status)
-	}
-
-	return nil
-}
-
-func (s *httpTNoDB) SetPublicIface(node pkg.Identifier, pub *types.PubIface) error {
-	url := fmt.Sprintf("%s/nodes/%s/configure_public", s.baseURL, node.Identity())
-
-	buf := &bytes.Buffer{}
-	if err := json.NewEncoder(buf).Encode(pub); err != nil {
-		return err
-	}
-
-	resp, err := http.Post(url, "application/json", buf)
-	if err != nil {
-		return err
-	}
-	defer resp.Body.Close()
-	if resp.StatusCode != http.StatusCreated {
-		return fmt.Errorf("wrong response status received: %s", resp.Status)
-	}
-	return nil
-}
-
-func (s *httpTNoDB) SelectExitNode(node pkg.Identifier) error {
-	url := fmt.Sprintf("%s/nodes/%s/select_exit", s.baseURL, node.Identity())
-
-	resp, err := http.Post(url, "application/json", nil)
-	if err != nil {
-		return err
-	}
-	defer resp.Body.Close()
-
-	if resp.StatusCode != http.StatusCreated {
-		return fmt.Errorf("wrong response status received: %s", resp.Status)
-	}
-	return nil
-}
-
-func (s *httpTNoDB) GetPubIface(node pkg.Identifier) (*types.PubIface, error) {
-
-	url := fmt.Sprintf("%s/nodes/%s", s.baseURL, node.Identity())
-	resp, err := http.Get(url)
-	if err != nil {
-		return nil, err
-	}
-	defer resp.Body.Close()
-
-	if resp.StatusCode == http.StatusNotFound {
-		return nil, network.ErrNoPubIface
-	}
-
-	if resp.StatusCode != http.StatusOK {
-		return nil, fmt.Errorf("wrong response status: %v", resp.Status)
-	}
-
-	iface := struct {
-		PublicConfig *directory.TfgridNodePublicIface1 `json:"public_config,omitempty"`
-	}{}
-	if err := json.NewDecoder(resp.Body).Decode(&iface); err != nil {
-		return nil, err
-	}
-
-	if iface.PublicConfig == nil {
-		return nil, network.ErrNoPubIface
-	}
-
-	return &types.PubIface{
-		Master: iface.PublicConfig.Master,
-		// Vlan:   iface.PublicConfig.Vlan, // doesn't seems to exists in gedis types
-		Type:    types.IfaceType(iface.PublicConfig.Type.String()),
-		GW4:     iface.PublicConfig.Gw4,
-		GW6:     iface.PublicConfig.Gw6,
-		IPv4:    types.NewIPNetFromSchema(iface.PublicConfig.Ipv4),
-		IPv6:    types.NewIPNetFromSchema(iface.PublicConfig.Ipv6),
-		Version: int(iface.PublicConfig.Version),
-	}, nil
-}
-
-func (s *httpTNoDB) GetNetwork(netid pkg.NetID) (*pkg.Network, error) {
-	url := fmt.Sprintf("%s/networks/%s", s.baseURL, string(netid))
-	resp, err := http.Get(url)
-	if err != nil {
-		return nil, err
-	}
-
-	defer resp.Body.Close()
-
-	if resp.StatusCode == http.StatusNotFound {
-		return nil, fmt.Errorf("network not found")
-	}
-	if resp.StatusCode != http.StatusOK {
-		return nil, fmt.Errorf("wrong response status code %s", resp.Status)
-	}
-
-	network := &pkg.Network{}
-	if err := json.NewDecoder(resp.Body).Decode(network); err != nil {
-		return nil, err
-	}
-	return network, nil
-}
-
-func (s *httpTNoDB) GetNetworksVersion(nodeID pkg.Identifier) (map[pkg.NetID]uint32, error) {
-	url := fmt.Sprintf("%s/networks/%s/versions", s.baseURL, nodeID.Identity())
-	resp, err := http.Get(url)
-	if err != nil {
-		return nil, err
-	}
-	defer resp.Body.Close()
-
-	versions := make(map[pkg.NetID]uint32)
-	if err := json.NewDecoder(resp.Body).Decode(&versions); err != nil {
-		return nil, err
-	}
-
-	return versions, nil
-}
diff --git a/pkg/network/types/types.go b/pkg/network/types/types.go
index 5db8b078..9690607f 100644
--- a/pkg/network/types/types.go
+++ b/pkg/network/types/types.go
@@ -4,7 +4,8 @@ import (
 	"fmt"
 	"net"
 
-	"github.com/threefoldtech/zos/pkg/gedis/types/directory"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/directory"
+
 	"github.com/threefoldtech/zos/pkg/schema"
 )
 
@@ -28,6 +29,21 @@ type IfaceInfo struct {
 	MacAddress schema.MacAddress `json:"macaddress"`
 }
 
+// NewIfaceInfoFromSchema creates an IfaceInfo from schema type
+func NewIfaceInfoFromSchema(iface directory.Iface) IfaceInfo {
+	return IfaceInfo{
+		Name: iface.Name,
+		Addrs: func() []IPNet {
+			var l []IPNet
+			for _, a := range iface.Addrs {
+				l = append(l, IPNet{a.IPNet})
+			}
+			return l
+		}(),
+		Gateway: iface.Gateway,
+	}
+}
+
 // DefaultIP return the IP address of the interface that has a default gateway configured
 // this function currently only check IPv6 addresses
 func (i *IfaceInfo) DefaultIP() (net.IP, error) {
@@ -49,6 +65,21 @@ func (i *IfaceInfo) DefaultIP() (net.IP, error) {
 	return nil, fmt.Errorf("no ipv6 address with default gateway")
 }
 
+// ToSchema converts IfaceInfo to a schema type
+func (i *IfaceInfo) ToSchema() directory.Iface {
+	return directory.Iface{
+		Name: i.Name,
+		Addrs: func() []schema.IPRange {
+			var l []schema.IPRange
+			for _, a := range i.Addrs {
+				l = append(l, schema.IPRange{IPNet: a.IPNet})
+			}
+			return l
+		}(),
+		Gateway: i.Gateway,
+	}
+}
+
 // PubIface is the configuration of the interface
 // that is connected to the public internet
 type PubIface struct {
@@ -68,6 +99,27 @@ type PubIface struct {
 	Version int `json:"version"`
 }
 
+// ToSchema converts PubIface to schema type
+func (p *PubIface) ToSchema() directory.PublicIface {
+	var typ directory.IfaceTypeEnum
+	switch p.Type {
+	case VlanIface:
+		typ = directory.IfaceTypeVlan
+	case MacVlanIface:
+		typ = directory.IfaceTypeMacvlan
+	}
+
+	return directory.PublicIface{
+		Master:  p.Master,
+		Type:    typ,
+		Ipv4:    p.IPv4.ToSchema(),
+		Ipv6:    p.IPv4.ToSchema(),
+		Gw4:     p.GW4,
+		Gw6:     p.GW6,
+		Version: int64(p.Version),
+	}
+}
+
 // Node is the public information about a node
 type Node struct {
 	NodeID string `json:"node_id"`
@@ -81,16 +133,22 @@ type Node struct {
 }
 
 // NewNodeFromSchema converts a TfgridNode2 into Node
-func NewNodeFromSchema(node directory.TfgridNode2) *Node {
+func NewNodeFromSchema(node directory.Node) *Node {
 	n := &Node{
-		NodeID: node.NodeID,
-		FarmID: node.FarmID,
+		NodeID: node.NodeId,
+		FarmID: uint64(node.FarmId),
 
 		Ifaces: make([]*IfaceInfo, len(node.Ifaces)),
 
 		PublicConfig: nil,
 		ExitNode:     0,
-		WGPorts:      node.WGPorts,
+		WGPorts: func() []uint {
+			var p []uint
+			for _, i := range node.WgPorts {
+				p = append(p, uint(i))
+			}
+			return p
+		}(),
 	}
 	if node.Ifaces != nil {
 		for i, iface := range node.Ifaces {
diff --git a/pkg/provision/converter.go b/pkg/provision/converter.go
index c7f297fa..0eb3dd99 100644
--- a/pkg/provision/converter.go
+++ b/pkg/provision/converter.go
@@ -8,33 +8,37 @@ import (
 
 	"github.com/threefoldtech/zos/pkg"
 	"github.com/threefoldtech/zos/pkg/container/logger"
-	generated "github.com/threefoldtech/zos/pkg/gedis/types/provision"
 	"github.com/threefoldtech/zos/pkg/network/types"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/workloads"
 )
 
 // ContainerToProvisionType converts TfgridReservationContainer1 to Container
-func ContainerToProvisionType(c generated.TfgridReservationContainer1) (Container, string, error) {
+func ContainerToProvisionType(c workloads.Container) (Container, string, error) {
 	container := Container{
 		FList:        c.Flist,
-		FlistStorage: c.HubURL,
+		FlistStorage: c.HubUrl,
 		Env:          c.Environment,
 		SecretEnv:    c.SecretEnvironment,
 		Entrypoint:   c.Entrypoint,
 		Interactive:  c.Interactive,
 		Mounts:       make([]Mount, len(c.Volumes)),
 		Logs:         make([]logger.Logs, len(c.Logs)),
+		Capacity: ContainerCapacity{
+			CPU:    uint(c.Capacity.Cpu),
+			Memory: uint64(c.Capacity.Memory),
+		},
 	}
 
 	if len(c.NetworkConnection) > 0 {
 		container.Network = Network{
 			IPs:       []net.IP{c.NetworkConnection[0].Ipaddress},
-			NetworkID: pkg.NetID(c.NetworkConnection[0].NetworkID),
+			NetworkID: pkg.NetID(c.NetworkConnection[0].NetworkId),
 		}
 	}
 
 	for i, mount := range c.Volumes {
 		container.Mounts[i] = Mount{
-			VolumeID:   mount.VolumeID,
+			VolumeID:   mount.VolumeId,
 			Mountpoint: mount.Mountpoint,
 		}
 	}
@@ -60,11 +64,11 @@ func ContainerToProvisionType(c generated.TfgridReservationContainer1) (Containe
 		}
 	}
 
-	return container, c.NodeID, nil
+	return container, c.NodeId, nil
 }
 
 // VolumeToProvisionType converts TfgridReservationVolume1 to Volume
-func VolumeToProvisionType(v generated.TfgridReservationVolume1) (Volume, string, error) {
+func VolumeToProvisionType(v workloads.Volume) (Volume, string, error) {
 	volume := Volume{
 		Size: uint64(v.Size),
 	}
@@ -74,13 +78,13 @@ func VolumeToProvisionType(v generated.TfgridReservationVolume1) (Volume, string
 	case "SSD":
 		volume.Type = SSDDiskType
 	default:
-		return volume, v.NodeID, fmt.Errorf("disk type %s not supported", v.Type.String())
+		return volume, v.NodeId, fmt.Errorf("disk type %s not supported", v.Type.String())
 	}
-	return volume, v.NodeID, nil
+	return volume, v.NodeId, nil
 }
 
 //ZDBToProvisionType converts TfgridReservationZdb1 to ZDB
-func ZDBToProvisionType(z generated.TfgridReservationZdb1) (ZDB, string, error) {
+func ZDBToProvisionType(z workloads.ZDB) (ZDB, string, error) {
 	zdb := ZDB{
 		Size:     uint64(z.Size),
 		Password: z.Password,
@@ -92,7 +96,7 @@ func ZDBToProvisionType(z generated.TfgridReservationZdb1) (ZDB, string, error)
 	case "ssd":
 		zdb.DiskType = pkg.SSDDevice
 	default:
-		return zdb, z.NodeID, fmt.Errorf("device type %s not supported", z.DiskType.String())
+		return zdb, z.NodeId, fmt.Errorf("device type %s not supported", z.DiskType.String())
 	}
 
 	switch z.Mode.String() {
@@ -101,31 +105,28 @@ func ZDBToProvisionType(z generated.TfgridReservationZdb1) (ZDB, string, error)
 	case "user":
 		zdb.Mode = pkg.ZDBModeUser
 	default:
-		return zdb, z.NodeID, fmt.Errorf("0-db mode %s not supported", z.Mode.String())
+		return zdb, z.NodeId, fmt.Errorf("0-db mode %s not supported", z.Mode.String())
 	}
 
-	return zdb, z.NodeID, nil
+	return zdb, z.NodeId, nil
 }
 
 // K8SToProvisionType converts type to internal provision type
-func K8SToProvisionType(k generated.TfgridWorkloadsReservationK8S1) (Kubernetes, string, error) {
+func K8SToProvisionType(k workloads.K8S) (Kubernetes, string, error) {
 	k8s := Kubernetes{
-		Size:          k.Size,
-		NetworkID:     pkg.NetID(k.NetworkID),
+		Size:          uint8(k.Size),
+		NetworkID:     pkg.NetID(k.NetworkId),
 		IP:            k.Ipaddress,
 		ClusterSecret: k.ClusterSecret,
-		MasterIPs:     make([]net.IP, len(k.MasterIps)),
-		SSHKeys:       make([]string, len(k.SSHKeys)),
+		MasterIPs:     k.MasterIps,
+		SSHKeys:       k.SshKeys,
 	}
 
-	copy(k8s.MasterIPs, k.MasterIps)
-	copy(k8s.SSHKeys, k.SSHKeys)
-
-	return k8s, k.NodeID, nil
+	return k8s, k.NodeId, nil
 }
 
 // NetworkToProvisionType convert TfgridReservationNetwork1 to pkg.Network
-func NetworkToProvisionType(n generated.TfgridReservationNetwork1) (pkg.Network, error) {
+func NetworkToProvisionType(n workloads.Network) (pkg.Network, error) {
 	network := pkg.Network{
 		Name:         n.Name,
 		NetID:        pkg.NetID(n.Name),
@@ -144,29 +145,25 @@ func NetworkToProvisionType(n generated.TfgridReservationNetwork1) (pkg.Network,
 }
 
 //WireguardToProvisionType converts WireguardPeer1 to pkg.Peer
-func WireguardToProvisionType(p generated.WireguardPeer1) (pkg.Peer, error) {
+func WireguardToProvisionType(p workloads.WireguardPeer) (pkg.Peer, error) {
 	peer := pkg.Peer{
 		WGPublicKey: p.PublicKey,
 		Endpoint:    p.Endpoint,
-		AllowedIPs:  make([]types.IPNet, len(p.AllowedIPs)),
-		Subnet:      types.NewIPNetFromSchema(p.IPRange),
+		AllowedIPs:  make([]types.IPNet, len(p.AllowedIprange)),
+		Subnet:      types.NewIPNetFromSchema(p.Iprange),
 	}
 
-	var err error
-	for i, ip := range p.AllowedIPs {
-		peer.AllowedIPs[i], err = types.ParseIPNet(ip)
-		if err != nil {
-			return peer, err
-		}
+	for i, ip := range p.AllowedIprange {
+		peer.AllowedIPs[i] = types.IPNet{IPNet: ip.IPNet}
 	}
 	return peer, nil
 }
 
 //NetResourceToProvisionType converts TfgridNetworkNetResource1 to pkg.NetResource
-func NetResourceToProvisionType(r generated.TfgridNetworkNetResource1) (pkg.NetResource, error) {
+func NetResourceToProvisionType(r workloads.NetworkNetResource) (pkg.NetResource, error) {
 	nr := pkg.NetResource{
-		NodeID:       r.NodeID,
-		Subnet:       types.NewIPNetFromSchema(r.IPRange),
+		NodeID:       r.NodeId,
+		Subnet:       types.NewIPNetFromSchema(r.Iprange),
 		WGPrivateKey: r.WireguardPrivateKeyEncrypted,
 		WGPublicKey:  r.WireguardPublicKey,
 		WGListenPort: uint16(r.WireguardListenPort),
@@ -185,16 +182,16 @@ func NetResourceToProvisionType(r generated.TfgridNetworkNetResource1) (pkg.NetR
 }
 
 // WorkloadToProvisionType TfgridReservationWorkload1 to provision.Reservation
-func WorkloadToProvisionType(w generated.TfgridReservationWorkload1) (*Reservation, error) {
+func WorkloadToProvisionType(w workloads.ReservationWorkload) (*Reservation, error) {
 	reservation := &Reservation{
-		ID:        w.WorkloadID,
+		ID:        w.WorkloadId,
 		User:      w.User,
 		Type:      ReservationType(w.Type.String()),
 		Created:   w.Created.Time,
 		Duration:  time.Duration(w.Duration) * time.Second,
 		Signature: []byte(w.Signature),
-		Data:      w.Workload,
-		ToDelete:  w.ToDelete,
+		// Data:      w.Content,
+		ToDelete: w.ToDelete,
 	}
 
 	var (
@@ -202,63 +199,34 @@ func WorkloadToProvisionType(w generated.TfgridReservationWorkload1) (*Reservati
 		err  error
 	)
 
-	// convert the workload description from jsx schema to zos types
-	switch reservation.Type {
-	case ZDBReservation:
-		tmp := generated.TfgridReservationZdb1{}
-		if err := json.Unmarshal(reservation.Data, &tmp); err != nil {
-			return nil, err
-		}
-
+	switch tmp := w.Content.(type) {
+	case workloads.ZDB:
 		data, reservation.NodeID, err = ZDBToProvisionType(tmp)
 		if err != nil {
 			return nil, err
 		}
-
-	case VolumeReservation:
-		tmp := generated.TfgridReservationVolume1{}
-		if err := json.Unmarshal(reservation.Data, &tmp); err != nil {
-			return nil, err
-		}
-
+	case workloads.Volume:
 		data, reservation.NodeID, err = VolumeToProvisionType(tmp)
 		if err != nil {
 			return nil, err
 		}
-
-	case NetworkReservation:
-		tmp := generated.TfgridReservationNetwork1{}
-		if err := json.Unmarshal(reservation.Data, &tmp); err != nil {
-			return nil, err
-		}
-
+	case workloads.Network:
 		data, err = NetworkToProvisionType(tmp)
 		if err != nil {
 			return nil, err
 		}
-
-	case ContainerReservation:
-		tmp := generated.TfgridReservationContainer1{}
-		if err := json.Unmarshal(reservation.Data, &tmp); err != nil {
-			return nil, err
-		}
-
+	case workloads.Container:
 		data, reservation.NodeID, err = ContainerToProvisionType(tmp)
 		if err != nil {
 			return nil, err
 		}
-
-	case KubernetesReservation:
-		tmp := generated.TfgridWorkloadsReservationK8S1{}
-		if err := json.Unmarshal(reservation.Data, &tmp); err != nil {
-			return nil, err
-		}
-
+	case workloads.K8S:
 		data, reservation.NodeID, err = K8SToProvisionType(tmp)
 		if err != nil {
 			return nil, err
 		}
-
+	default:
+		return nil, fmt.Errorf("unknown workload type (%s) (%T)", w.Type.String(), tmp)
 	}
 
 	reservation.Data, err = json.Marshal(data)
diff --git a/pkg/provision/engine.go b/pkg/provision/engine.go
index 6971c613..e06e0e66 100644
--- a/pkg/provision/engine.go
+++ b/pkg/provision/engine.go
@@ -9,6 +9,8 @@ import (
 
 	"github.com/threefoldtech/zos/pkg"
 	"github.com/threefoldtech/zos/pkg/stubs"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/directory"
+	"github.com/threefoldtech/zos/tools/client"
 
 	"github.com/pkg/errors"
 	"github.com/rs/zerolog/log"
@@ -36,7 +38,7 @@ type defaultEngine struct {
 	nodeID string
 	source ReservationSource
 	store  ReservationCache
-	fb     Feedbacker
+	cl     *client.Client
 }
 
 // New creates a new engine. Once started, the engine
@@ -45,12 +47,12 @@ type defaultEngine struct {
 // the default implementation is a single threaded worker. so it process
 // one reservation at a time. On error, the engine will log the error. and
 // continue to next reservation.
-func New(nodeID string, source ReservationSource, rw ReservationCache, fb Feedbacker) Engine {
+func New(nodeID string, source ReservationSource, rw ReservationCache, cl *client.Client) Engine {
 	return &defaultEngine{
 		nodeID: nodeID,
 		source: source,
 		store:  rw,
-		fb:     fb,
+		cl:     cl,
 	}
 }
 
@@ -98,7 +100,14 @@ func (e *defaultEngine) Run(ctx context.Context) error {
 					continue
 				}
 			}
-			if err := e.fb.UpdateReservedResources(e.nodeID, e.store.Counters()); err != nil {
+			counters := e.store.Counters()
+			amount := directory.ResourceAmount{
+				Sru: counters.SRU.Current(),
+				Hru: counters.MRU.Current(),
+				Cru: counters.CRU.Current(),
+				Mru: counters.MRU.Current(),
+			}
+			if err := e.cl.Directory.NodeUpdateUsedResources(e.nodeID, amount); err != nil {
 				log.Error().Err(err).Msg("failed to updated the used resources")
 			}
 		}
@@ -151,7 +160,7 @@ func (e *defaultEngine) decommission(ctx context.Context, r *Reservation) error
 
 	if !exists {
 		log.Info().Str("id", r.ID).Msg("reservation not provisioned, no need to decomission")
-		if err := e.fb.Deleted(e.nodeID, r.ID); err != nil {
+		if err := e.cl.Workloads.WorkloadPutDeleted(e.nodeID, r.ID); err != nil {
 			log.Error().Err(err).Str("id", r.ID).Msg("failed to mark reservation as deleted")
 		}
 		return nil
@@ -166,7 +175,7 @@ func (e *defaultEngine) decommission(ctx context.Context, r *Reservation) error
 		return errors.Wrapf(err, "failed to remove reservation %s from cache", r.ID)
 	}
 
-	if err := e.fb.Deleted(e.nodeID, r.ID); err != nil {
+	if err := e.cl.Workloads.WorkloadPutDeleted(e.nodeID, r.ID); err != nil {
 		return errors.Wrap(err, "failed to mark reservation as deleted")
 	}
 
@@ -215,7 +224,7 @@ func (e *defaultEngine) reply(ctx context.Context, r *Reservation, rErr error, i
 	}
 	result.Signature = hex.EncodeToString(sig)
 
-	return e.fb.Feedback(e.nodeID, result)
+	return e.cl.Workloads.WorkloadPutResult(e.nodeID, r.ID, result.ToSchemaType())
 }
 
 func (e *defaultEngine) Counters(ctx context.Context) <-chan pkg.ProvisionCounters {
diff --git a/pkg/provision/owner_cache.go b/pkg/provision/owner_cache.go
index e34e2d70..f5517c87 100644
--- a/pkg/provision/owner_cache.go
+++ b/pkg/provision/owner_cache.go
@@ -2,6 +2,8 @@ package provision
 
 import (
 	"fmt"
+
+	"github.com/threefoldtech/zos/tools/client"
 )
 
 // ReservationGetter define the interface how to get
@@ -10,6 +12,24 @@ type ReservationGetter interface {
 	Get(id string) (*Reservation, error)
 }
 
+type reservationGetter struct {
+	wl client.Workloads
+}
+
+func (r *reservationGetter) Get(id string) (*Reservation, error) {
+	l, err := r.wl.WorkloadGet(id)
+	if err != nil {
+		return nil, err
+	}
+
+	return WorkloadToProvisionType(l)
+}
+
+// ReservationGetterFromWorkloads get a reservation getter from the client.Workloads interface
+func ReservationGetterFromWorkloads(wl client.Workloads) ReservationGetter {
+	return &reservationGetter{wl: wl}
+}
+
 // ownerCache allows to get the user ID of owner of a reservation
 type ownerCache struct {
 	local  ReservationGetter
diff --git a/pkg/provision/remote_store.go b/pkg/provision/remote_store.go
deleted file mode 100644
index 5f0af0e3..00000000
--- a/pkg/provision/remote_store.go
+++ /dev/null
@@ -1,269 +0,0 @@
-package provision
-
-import (
-	"bytes"
-	"encoding/hex"
-	"encoding/json"
-	"fmt"
-	"net/http"
-	"net/url"
-
-	"github.com/pkg/errors"
-	"github.com/rs/zerolog/log"
-	"github.com/threefoldtech/zos/pkg"
-	generated "github.com/threefoldtech/zos/pkg/gedis/types/provision"
-	"github.com/threefoldtech/zos/pkg/schema"
-)
-
-// HTTPStore is a reservation store
-// over HTTP
-type HTTPStore struct {
-	baseURL string
-}
-
-// NewHTTPStore creates an a client to a TNoDB reachable over HTTP
-func NewHTTPStore(url string) *HTTPStore {
-	return &HTTPStore{baseURL: url}
-}
-
-// Reserve adds a reservation to the BCDB
-func (s *HTTPStore) Reserve(r *Reservation) (string, error) {
-	if r.NodeID == "" {
-		return "", fmt.Errorf("nodeID cannot be empty in the reservation")
-	}
-	url := fmt.Sprintf("%s/reservations/%s", s.baseURL, r.NodeID)
-
-	buf := &bytes.Buffer{}
-
-	if err := json.NewEncoder(buf).Encode(r); err != nil {
-		return "", err
-	}
-
-	resp, err := http.Post(url, "application/json", buf)
-	if err != nil {
-		return "", err
-	}
-
-	defer resp.Body.Close()
-
-	// Extract the Location header which contains
-	// url to get information about the created resource
-	resource := resp.Header.Get("Location")
-
-	if resp.StatusCode != http.StatusCreated {
-		return "", fmt.Errorf("wrong response status code %s", resp.Status)
-	}
-
-	return resource, nil
-}
-
-// Poll retrieves reservations from BCDB. from acts like a cursor, first call should use
-// 0  to retrieve everything. Next calls should use the last+1 ID of the previous poll.
-// Note that from is a reservation ID not a workload ID. so user the Reservation.SplitID() method
-// to get the reservation part.
-func (s *HTTPStore) Poll(nodeID pkg.Identifier, from uint64) ([]*Reservation, error) {
-	u, err := url.Parse(fmt.Sprintf("%s/reservations/workloads/%s", s.baseURL, nodeID.Identity()))
-	if err != nil {
-		return nil, err
-	}
-	q := u.Query()
-	q.Add("from", fmt.Sprintf("%d", from))
-
-	u.RawQuery = q.Encode()
-
-	log.Debug().Str("url", u.String()).Msg("fetching")
-
-	resp, err := http.Get(u.String())
-	if err != nil {
-		return nil, NewErrTemporary(err)
-	}
-
-	defer resp.Body.Close()
-
-	if resp.StatusCode != http.StatusOK {
-		return nil, NewErrTemporary(err)
-	}
-
-	if resp.Header.Get("content-type") != "application/json" {
-		return nil, NewErrTemporary(err)
-	}
-
-	workloads := []generated.TfgridReservationWorkload1{}
-	if err := json.NewDecoder(resp.Body).Decode(&workloads); err != nil {
-		return nil, err
-	}
-	reservations := make([]*Reservation, 0, len(workloads))
-	for _, wl := range workloads {
-		r, err := WorkloadToProvisionType(wl)
-		if err != nil {
-			return nil, errors.Wrap(err, "failed to load workload type")
-		}
-		r.Tag = Tag{"source": "HTTPStore"}
-		reservations = append(reservations, r)
-	}
-	return reservations, nil
-}
-
-// Get retrieves a single reservation using its ID
-func (s *HTTPStore) Get(id string) (*Reservation, error) {
-	url := fmt.Sprintf("%s/reservations/workloads/%s", s.baseURL, id)
-
-	r := &Reservation{}
-	resp, err := http.Get(url)
-	if err != nil {
-		return r, err
-	}
-
-	defer resp.Body.Close()
-
-	if resp.StatusCode != http.StatusOK {
-		return r, fmt.Errorf("wrong response status code %s", resp.Status)
-	}
-
-	if err := json.NewDecoder(resp.Body).Decode(r); err != nil {
-		return r, err
-	}
-	r.Tag = Tag{"source": "HTTPSource"}
-	return r, nil
-}
-
-// Feedback sends back the result of a provisioning to BCDB
-func (s *HTTPStore) Feedback(nodeID string, r *Result) error {
-	url := fmt.Sprintf("%s/reservations/workloads/%s/%s", s.baseURL, r.ID, nodeID)
-
-	var rType generated.TfgridReservationResult1CategoryEnum
-	switch r.Type {
-	case VolumeReservation:
-		rType = generated.TfgridReservationResult1CategoryVolume
-	case ContainerReservation:
-		rType = generated.TfgridReservationResult1CategoryContainer
-	case ZDBReservation:
-		rType = generated.TfgridReservationResult1CategoryZdb
-	case NetworkReservation:
-		rType = generated.TfgridReservationResult1CategoryNetwork
-	}
-
-	result := generated.TfgridReservationResult1{
-		Category:   rType,
-		WorkloadID: r.ID,
-		DataJSON:   r.Data,
-		Signature:  r.Signature,
-		State:      generated.TfgridReservationResult1StateEnum(r.State),
-		Message:    r.Error,
-		Epoch:      schema.Date{Time: r.Created},
-	}
-
-	buf := &bytes.Buffer{}
-
-	if err := json.NewEncoder(buf).Encode(result); err != nil {
-		return err
-	}
-
-	req, err := http.NewRequest(http.MethodPut, url, buf)
-	if err != nil {
-		return err
-	}
-
-	resp, err := http.DefaultClient.Do(req)
-	if err != nil {
-		return err
-	}
-
-	defer resp.Body.Close()
-
-	if resp.StatusCode != http.StatusCreated {
-		return fmt.Errorf("wrong response status code %s", resp.Status)
-	}
-	return nil
-}
-
-// Deleted marks a reservation as deleted
-func (s *HTTPStore) Deleted(nodeID, id string) error {
-	url := fmt.Sprintf("%s/reservations/workloads/%s/%s", s.baseURL, id, nodeID)
-
-	req, err := http.NewRequest(http.MethodDelete, url, nil)
-	if err != nil {
-		return err
-	}
-
-	resp, err := http.DefaultClient.Do(req)
-	if err != nil {
-		return err
-	}
-
-	defer resp.Body.Close()
-
-	if resp.StatusCode != http.StatusOK {
-		return fmt.Errorf("wrong response status code %s", resp.Status)
-	}
-	return nil
-}
-
-// Delete marks a reservation as to be deleted, signature
-// is of the `str(reservation.id) + reservation.json`
-func (s *HTTPStore) Delete(userID, resID int64, sig []byte) error {
-	url := fmt.Sprintf("%s/reservations/%d/sign/delete", s.baseURL, resID)
-
-	signature := generated.TfgridReservationSigningSignature1{
-		Tid:       userID,
-		Signature: hex.EncodeToString(sig),
-	}
-
-	var buf bytes.Buffer
-	if err := json.NewEncoder(&buf).Encode(signature); err != nil {
-		return err
-	}
-
-	req, err := http.NewRequest(http.MethodPost, url, &buf)
-	if err != nil {
-		return err
-	}
-
-	resp, err := http.DefaultClient.Do(req)
-	if err != nil {
-		return err
-	}
-
-	defer resp.Body.Close()
-
-	if resp.StatusCode != http.StatusCreated {
-		return fmt.Errorf("wrong response status code %s", resp.Status)
-	}
-
-	return nil
-}
-
-// UpdateReservedResources send the amount of resource units reserved to BCDB
-func (s *HTTPStore) UpdateReservedResources(nodeID string, c Counters) error {
-	url := fmt.Sprintf("%s/nodes/%s/used_resources", s.baseURL, nodeID)
-
-	u := resourceUnits{
-		CRU: int64(c.CRU),
-		MRU: int64(c.MRU),
-		SRU: int64(c.SRU),
-		HRU: int64(c.HRU),
-	}
-
-	buf := &bytes.Buffer{}
-	if err := json.NewEncoder(buf).Encode(u); err != nil {
-		return err
-	}
-
-	req, err := http.NewRequest("POST", url, buf)
-	if err != nil {
-		return err
-	}
-
-	resp, err := http.DefaultClient.Do(req)
-	if err != nil {
-		return err
-	}
-
-	defer resp.Body.Close()
-
-	if resp.StatusCode != http.StatusOK {
-		return fmt.Errorf("wrong response status code %s", resp.Status)
-	}
-	return nil
-
-}
diff --git a/pkg/provision/reservation.go b/pkg/provision/reservation.go
index 82c9aef2..c136afb1 100644
--- a/pkg/provision/reservation.go
+++ b/pkg/provision/reservation.go
@@ -9,8 +9,10 @@ import (
 	"time"
 
 	"github.com/pkg/errors"
-	generated "github.com/threefoldtech/zos/pkg/gedis/types/provision"
+	"github.com/threefoldtech/zos/pkg"
+	"github.com/threefoldtech/zos/pkg/schema"
 	"github.com/threefoldtech/zos/pkg/versioned"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/workloads"
 )
 
 // ReservationType type
@@ -146,20 +148,222 @@ func (r *Reservation) validate() error {
 	return nil
 }
 
+// ToSchemaType creates a TfgridReservation1 from zos provision types
+func (r *Reservation) ToSchemaType() (res workloads.Reservation, err error) {
+
+	w, err := workloadFromRaw(r.Data, r.Type)
+	if err != nil {
+		return res, err
+	}
+
+	switch r.Type {
+	case ContainerReservation:
+		res.DataReservation.Containers = []workloads.Container{
+			containerReservation(w, r.NodeID),
+		}
+	case VolumeReservation:
+		res.DataReservation.Volumes = []workloads.Volume{
+			volumeReservation(w, r.NodeID),
+		}
+	case ZDBReservation:
+		res.DataReservation.Zdbs = []workloads.ZDB{
+			zdbReservation(w, r.NodeID),
+		}
+	case NetworkReservation:
+		res.DataReservation.Networks = []workloads.Network{
+			networkReservation(w),
+		}
+	case KubernetesReservation:
+		res.DataReservation.Kubernetes = []workloads.K8S{
+			k8sReservation(w, r.NodeID),
+		}
+	}
+
+	res.Epoch = schema.Date{Time: r.Created}
+	res.DataReservation.ExpirationReservation = schema.Date{Time: r.Created.Add(r.Duration)}
+	res.DataReservation.ExpirationProvisioning = schema.Date{Time: r.Created.Add(2 * time.Minute)}
+
+	return res, nil
+}
+
+func workloadFromRaw(s json.RawMessage, t ReservationType) (interface{}, error) {
+	switch t {
+	case ContainerReservation:
+		c := Container{}
+		err := json.Unmarshal([]byte(s), &c)
+		return c, err
+
+	case VolumeReservation:
+		v := Volume{}
+		err := json.Unmarshal([]byte(s), &v)
+		return v, err
+
+	case NetworkReservation:
+		n := pkg.Network{}
+		err := json.Unmarshal([]byte(s), &n)
+		return n, err
+
+	case ZDBReservation:
+		z := ZDB{}
+		err := json.Unmarshal([]byte(s), &z)
+		return z, err
+
+	case KubernetesReservation:
+		k := Kubernetes{}
+		err := json.Unmarshal([]byte(s), &k)
+		return k, err
+	}
+
+	return nil, fmt.Errorf("unsupported reservation type %v", t)
+}
+
+func networkReservation(i interface{}) workloads.Network {
+	n := i.(pkg.Network)
+	network := workloads.Network{
+		Name:             n.Name,
+		Iprange:          n.IPRange.ToSchema(),
+		WorkloadId:       1,
+		NetworkResources: make([]workloads.NetworkNetResource, len(n.NetResources)),
+	}
+
+	for i, nr := range n.NetResources {
+		network.NetworkResources[i] = workloads.NetworkNetResource{
+			NodeId:                       nr.NodeID,
+			Iprange:                      nr.Subnet.ToSchema(),
+			WireguardPrivateKeyEncrypted: nr.WGPrivateKey,
+			WireguardPublicKey:           nr.WGPublicKey,
+			WireguardListenPort:          int64(nr.WGListenPort),
+			Peers:                        make([]workloads.WireguardPeer, len(nr.Peers)),
+		}
+
+		for y, peer := range nr.Peers {
+			network.NetworkResources[i].Peers[y] = workloads.WireguardPeer{
+				Iprange:        peer.Subnet.ToSchema(),
+				Endpoint:       peer.Endpoint,
+				PublicKey:      peer.WGPublicKey,
+				AllowedIprange: make([]schema.IPRange, len(peer.AllowedIPs)),
+			}
+
+			for z, ip := range peer.AllowedIPs {
+				network.NetworkResources[i].Peers[y].AllowedIprange[z] = ip.ToSchema()
+			}
+		}
+	}
+	return network
+}
+
+func containerReservation(i interface{}, nodeID string) workloads.Container {
+
+	c := i.(Container)
+	container := workloads.Container{
+		NodeId:            nodeID,
+		WorkloadId:        1,
+		Flist:             c.FList,
+		HubUrl:            c.FlistStorage,
+		Environment:       c.Env,
+		SecretEnvironment: c.SecretEnv,
+		Entrypoint:        c.Entrypoint,
+		Interactive:       c.Interactive,
+		Volumes:           make([]workloads.ContainerMount, len(c.Mounts)),
+		NetworkConnection: []workloads.NetworkConnection{
+			{
+				NetworkId: string(c.Network.NetworkID),
+				Ipaddress: c.Network.IPs[0],
+				PublicIp6: c.Network.PublicIP6,
+			},
+		},
+		Capacity: workloads.ContainerCapacity{
+			Cpu:    int64(c.Capacity.CPU),
+			Memory: int64(c.Capacity.Memory),
+		},
+	}
+
+	for i, v := range c.Mounts {
+		container.Volumes[i] = workloads.ContainerMount{
+			VolumeId:   v.VolumeID,
+			Mountpoint: v.Mountpoint,
+		}
+	}
+	return container
+}
+
+func volumeReservation(i interface{}, nodeID string) workloads.Volume {
+	v := i.(Volume)
+
+	volume := workloads.Volume{
+		NodeId:     nodeID,
+		WorkloadId: 1,
+		Size:       int64(v.Size),
+	}
+
+	if v.Type == HDDDiskType {
+		volume.Type = workloads.VolumeTypeHDD
+	} else if v.Type == SSDDiskType {
+		volume.Type = workloads.VolumeTypeSSD
+	}
+
+	return volume
+}
+
+func zdbReservation(i interface{}, nodeID string) workloads.ZDB {
+	z := i.(ZDB)
+
+	zdb := workloads.ZDB{
+		WorkloadId: 1,
+		NodeId:     nodeID,
+		// ReservationID:
+		Size:     int64(z.Size),
+		Password: z.Password,
+		Public:   z.Public,
+		// StatsAggregator:
+		// FarmerTid:
+	}
+	if z.DiskType == pkg.SSDDevice {
+		zdb.DiskType = workloads.DiskTypeHDD
+	} else if z.DiskType == pkg.HDDDevice {
+		zdb.DiskType = workloads.DiskTypeSSD
+	}
+
+	if z.Mode == pkg.ZDBModeUser {
+		zdb.Mode = workloads.ZDBModeUser
+	} else if z.Mode == pkg.ZDBModeSeq {
+		zdb.Mode = workloads.ZDBModeSeq
+	}
+
+	return zdb
+}
+
+func k8sReservation(i interface{}, nodeID string) workloads.K8S {
+	k := i.(Kubernetes)
+
+	k8s := workloads.K8S{
+		WorkloadId:    1,
+		NodeId:        nodeID,
+		Size:          int64(k.Size),
+		NetworkId:     string(k.NetworkID),
+		Ipaddress:     k.IP,
+		ClusterSecret: k.ClusterSecret,
+		MasterIps:     k.MasterIPs,
+		SshKeys:       k.SSHKeys,
+	}
+
+	return k8s
+}
+
 // ResultState type
-type ResultState generated.TfgridReservationResult1StateEnum
+type ResultState workloads.ResultStateEnum
 
 const (
 	// StateError constant
-	StateError = ResultState(generated.TfgridReservationResult1StateError)
+	StateError = ResultState(workloads.ResultStateError)
 	// StateOk constant
-	StateOk = ResultState(generated.TfgridReservationResult1StateOk)
+	StateOk = ResultState(workloads.ResultStateOK)
 	//StateDeleted constant
-	StateDeleted = ResultState(generated.TfgridReservationResult1StateDeleted)
+	StateDeleted = ResultState(workloads.ResultStateDeleted)
 )
 
 func (s ResultState) String() string {
-	return generated.TfgridReservationResult1StateEnum(s).String()
+	return workloads.ResultStateEnum(s).String()
 }
 
 // Result is the struct filled by the node
@@ -200,3 +404,34 @@ func (r *Result) Bytes() ([]byte, error) {
 
 	return buf.Bytes(), nil
 }
+
+// ToSchemaType converts result to schema type
+func (r *Result) ToSchemaType() workloads.Result {
+	var rType workloads.ResultCategoryEnum
+	switch r.Type {
+	case VolumeReservation:
+		rType = workloads.ResultCategoryVolume
+	case ContainerReservation:
+		rType = workloads.ResultCategoryContainer
+	case ZDBReservation:
+		rType = workloads.ResultCategoryZDB
+	case NetworkReservation:
+		rType = workloads.ResultCategoryNetwork
+	case KubernetesReservation:
+		rType = workloads.ResultCategoryK8S
+	default:
+		panic(fmt.Errorf("unknown reservation type: %s", r.Type))
+	}
+
+	result := workloads.Result{
+		Category:   rType,
+		WorkloadId: r.ID,
+		DataJson:   r.Data,
+		Signature:  r.Signature,
+		State:      workloads.ResultStateEnum(r.State),
+		Message:    r.Error,
+		Epoch:      schema.Date{Time: r.Created},
+	}
+
+	return result
+}
diff --git a/pkg/provision/source.go b/pkg/provision/source.go
index f56ca14a..c5c5c4d5 100644
--- a/pkg/provision/source.go
+++ b/pkg/provision/source.go
@@ -9,6 +9,7 @@ import (
 
 	"github.com/rs/zerolog/log"
 	"github.com/threefoldtech/zos/pkg"
+	"github.com/threefoldtech/zos/tools/client"
 )
 
 type pollSource struct {
@@ -34,6 +35,34 @@ type ReservationPoller interface {
 	Poll(nodeID pkg.Identifier, from uint64) ([]*Reservation, error)
 }
 
+type reservationPoller struct {
+	wl client.Workloads
+}
+
+func (r *reservationPoller) Poll(nodeID pkg.Identifier, from uint64) ([]*Reservation, error) {
+	list, err := r.wl.Workloads(nodeID.Identity(), from)
+	if err != nil {
+		return nil, err
+	}
+
+	result := make([]*Reservation, 0, len(list))
+	for _, wl := range list {
+		r, err := WorkloadToProvisionType(wl)
+		if err != nil {
+			return nil, err
+		}
+
+		result = append(result, r)
+	}
+
+	return result, nil
+}
+
+// ReservationPollerFromWorkloads returns a reservation poller from client.Workloads
+func ReservationPollerFromWorkloads(wl client.Workloads) ReservationPoller {
+	return &reservationPoller{wl: wl}
+}
+
 // PollSource does a long poll on address to get new and to be deleted
 // reservations. the server should only return unique reservations
 // stall the connection as long as possible if no new reservations
diff --git a/tools/bcdb_mock/models/generated/directory/directory.go b/tools/bcdb_mock/models/generated/directory/directory.go
index 2560c651..e28fa441 100644
--- a/tools/bcdb_mock/models/generated/directory/directory.go
+++ b/tools/bcdb_mock/models/generated/directory/directory.go
@@ -7,46 +7,46 @@ import (
 	schema "github.com/threefoldtech/zos/pkg/schema"
 )
 
-type TfgridDirectoryFarm1 struct {
-	ID              schema.ID                           `bson:"_id" json:"id"`
-	ThreebotId      int64                               `bson:"threebot_id" json:"threebot_id"`
-	IyoOrganization string                              `bson:"iyo_organization" json:"iyo_organization"`
-	Name            string                              `bson:"name" json:"name"`
-	WalletAddresses []string                            `bson:"wallet_addresses" json:"wallet_addresses"`
-	Location        TfgridDirectoryLocation1            `bson:"location" json:"location"`
-	Email           schema.Email                        `bson:"email" json:"email"`
-	ResourcePrices  []TfgridDirectoryNodeResourcePrice1 `bson:"resource_prices" json:"resource_prices"`
-	PrefixZero      schema.IPRange                      `bson:"prefix_zero" json:"prefix_zero"`
-}
-
-func NewTfgridDirectoryFarm1() (TfgridDirectoryFarm1, error) {
+type Farm struct {
+	ID              schema.ID           `bson:"_id" json:"id"`
+	ThreebotId      int64               `bson:"threebot_id" json:"threebot_id"`
+	IyoOrganization string              `bson:"iyo_organization" json:"iyo_organization"`
+	Name            string              `bson:"name" json:"name"`
+	WalletAddresses []string            `bson:"wallet_addresses" json:"wallet_addresses"`
+	Location        Location            `bson:"location" json:"location"`
+	Email           schema.Email        `bson:"email" json:"email"`
+	ResourcePrices  []NodeResourcePrice `bson:"resource_prices" json:"resource_prices"`
+	PrefixZero      schema.IPRange      `bson:"prefix_zero" json:"prefix_zero"`
+}
+
+func NewFarm() (Farm, error) {
 	const value = "{}"
-	var object TfgridDirectoryFarm1
+	var object Farm
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridDirectoryNodeResourcePrice1 struct {
-	Currency TfgridDirectoryNodeResourcePrice1CurrencyEnum `bson:"currency" json:"currency"`
-	Cru      float64                                       `bson:"cru" json:"cru"`
-	Mru      float64                                       `bson:"mru" json:"mru"`
-	Hru      float64                                       `bson:"hru" json:"hru"`
-	Sru      float64                                       `bson:"sru" json:"sru"`
-	Nru      float64                                       `bson:"nru" json:"nru"`
+type NodeResourcePrice struct {
+	Currency PriceCurrencyEnum `bson:"currency" json:"currency"`
+	Cru      float64           `bson:"cru" json:"cru"`
+	Mru      float64           `bson:"mru" json:"mru"`
+	Hru      float64           `bson:"hru" json:"hru"`
+	Sru      float64           `bson:"sru" json:"sru"`
+	Nru      float64           `bson:"nru" json:"nru"`
 }
 
-func NewTfgridDirectoryNodeResourcePrice1() (TfgridDirectoryNodeResourcePrice1, error) {
+func NewNodeResourcePrice() (NodeResourcePrice, error) {
 	const value = "{}"
-	var object TfgridDirectoryNodeResourcePrice1
+	var object NodeResourcePrice
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridDirectoryLocation1 struct {
+type Location struct {
 	City      string  `bson:"city" json:"city"`
 	Country   string  `bson:"country" json:"country"`
 	Continent string  `bson:"continent" json:"continent"`
@@ -54,99 +54,99 @@ type TfgridDirectoryLocation1 struct {
 	Longitude float64 `bson:"longitude" json:"longitude"`
 }
 
-func NewTfgridDirectoryLocation1() (TfgridDirectoryLocation1, error) {
+func NewLocation() (Location, error) {
 	const value = "{}"
-	var object TfgridDirectoryLocation1
+	var object Location
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridDirectoryNode2 struct {
-	ID                schema.ID                          `bson:"_id" json:"id"`
-	NodeId            string                             `bson:"node_id" json:"node_id"`
-	NodeIdV1          string                             `bson:"node_id_v1" json:"node_id_v1"`
-	FarmId            int64                              `bson:"farm_id" json:"farm_id"`
-	OsVersion         string                             `bson:"os_version" json:"os_version"`
-	Created           schema.Date                        `bson:"created" json:"created"`
-	Updated           schema.Date                        `bson:"updated" json:"updated"`
-	Uptime            int64                              `bson:"uptime" json:"uptime"`
-	Address           string                             `bson:"address" json:"address"`
-	Location          TfgridDirectoryLocation1           `bson:"location" json:"location"`
-	TotalResources    TfgridDirectoryNodeResourceAmount1 `bson:"total_resources" json:"total_resources"`
-	UsedResources     TfgridDirectoryNodeResourceAmount1 `bson:"used_resources" json:"used_resources"`
-	ReservedResources TfgridDirectoryNodeResourceAmount1 `bson:"reserved_resources" json:"reserved_resources"`
-	Proofs            []TfgridDirectoryNodeProof1        `bson:"proofs" json:"proofs"`
-	Ifaces            []TfgridDirectoryNodeIface1        `bson:"ifaces" json:"ifaces"`
-	PublicConfig      *TfgridDirectoryNodePublicIface1   `bson:"public_config,omitempty" json:"public_config"`
-	ExitNode          bool                               `bson:"exit_node" json:"exit_node"`
-	Approved          bool                               `bson:"approved" json:"approved"`
-	PublicKeyHex      string                             `bson:"public_key_hex" json:"public_key_hex"`
-	WgPorts           []int64                            `bson:"wg_ports" json:"wg_ports"`
-}
-
-func NewTfgridDirectoryNode2() (TfgridDirectoryNode2, error) {
+type Node struct {
+	ID                schema.ID      `bson:"_id" json:"id"`
+	NodeId            string         `bson:"node_id" json:"node_id"`
+	NodeIdV1          string         `bson:"node_id_v1" json:"node_id_v1"`
+	FarmId            int64          `bson:"farm_id" json:"farm_id"`
+	OsVersion         string         `bson:"os_version" json:"os_version"`
+	Created           schema.Date    `bson:"created" json:"created"`
+	Updated           schema.Date    `bson:"updated" json:"updated"`
+	Uptime            int64          `bson:"uptime" json:"uptime"`
+	Address           string         `bson:"address" json:"address"`
+	Location          Location       `bson:"location" json:"location"`
+	TotalResources    ResourceAmount `bson:"total_resources" json:"total_resources"`
+	UsedResources     ResourceAmount `bson:"used_resources" json:"used_resources"`
+	ReservedResources ResourceAmount `bson:"reserved_resources" json:"reserved_resources"`
+	Proofs            []Proof        `bson:"proofs" json:"proofs"`
+	Ifaces            []Iface        `bson:"ifaces" json:"ifaces"`
+	PublicConfig      *PublicIface   `bson:"public_config,omitempty" json:"public_config"`
+	ExitNode          bool           `bson:"exit_node" json:"exit_node"`
+	Approved          bool           `bson:"approved" json:"approved"`
+	PublicKeyHex      string         `bson:"public_key_hex" json:"public_key_hex"`
+	WgPorts           []int64        `bson:"wg_ports" json:"wg_ports"`
+}
+
+func NewNode() (Node, error) {
 	const value = "{\"approved\": false, \"public_key_hex\": \"\"}"
-	var object TfgridDirectoryNode2
+	var object Node
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridDirectoryNodeIface1 struct {
+type Iface struct {
 	Name       string            `bson:"name" json:"name"`
 	Addrs      []schema.IPRange  `bson:"addrs" json:"addrs"`
 	Gateway    []net.IP          `bson:"gateway" json:"gateway"`
 	MacAddress schema.MacAddress `bson:"macaddress" json:"macaddress"`
 }
 
-func NewTfgridDirectoryNodeIface1() (TfgridDirectoryNodeIface1, error) {
+func NewIface() (Iface, error) {
 	const value = "{}"
-	var object TfgridDirectoryNodeIface1
+	var object Iface
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridDirectoryNodePublicIface1 struct {
-	Master  string                                  `bson:"master" json:"master"`
-	Type    TfgridDirectoryNodePublicIface1TypeEnum `bson:"type" json:"type"`
-	Ipv4    schema.IPRange                          `bson:"ipv4" json:"ipv4"`
-	Ipv6    schema.IPRange                          `bson:"ipv6" json:"ipv6"`
-	Gw4     net.IP                                  `bson:"gw4" json:"gw4"`
-	Gw6     net.IP                                  `bson:"gw6" json:"gw6"`
-	Version int64                                   `bson:"version" json:"version"`
+type PublicIface struct {
+	Master  string         `bson:"master" json:"master"`
+	Type    IfaceTypeEnum  `bson:"type" json:"type"`
+	Ipv4    schema.IPRange `bson:"ipv4" json:"ipv4"`
+	Ipv6    schema.IPRange `bson:"ipv6" json:"ipv6"`
+	Gw4     net.IP         `bson:"gw4" json:"gw4"`
+	Gw6     net.IP         `bson:"gw6" json:"gw6"`
+	Version int64          `bson:"version" json:"version"`
 }
 
-func NewTfgridDirectoryNodePublicIface1() (TfgridDirectoryNodePublicIface1, error) {
+func NewPublicIface() (PublicIface, error) {
 	const value = "{}"
-	var object TfgridDirectoryNodePublicIface1
+	var object PublicIface
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridDirectoryNodeResourceAmount1 struct {
+type ResourceAmount struct {
 	Cru int64 `bson:"cru" json:"cru"`
 	Mru int64 `bson:"mru" json:"mru"`
 	Hru int64 `bson:"hru" json:"hru"`
 	Sru int64 `bson:"sru" json:"sru"`
 }
 
-func NewTfgridDirectoryNodeResourceAmount1() (TfgridDirectoryNodeResourceAmount1, error) {
+func NewResourceAmount() (ResourceAmount, error) {
 	const value = "{}"
-	var object TfgridDirectoryNodeResourceAmount1
+	var object ResourceAmount
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridDirectoryNodeProof1 struct {
+type Proof struct {
 	Created      schema.Date            `bson:"created" json:"created"`
 	HardwareHash string                 `bson:"hardware_hash" json:"hardware_hash"`
 	DiskHash     string                 `bson:"disk_hash" json:"disk_hash"`
@@ -155,53 +155,53 @@ type TfgridDirectoryNodeProof1 struct {
 	Hypervisor   []string               `bson:"hypervisor" json:"hypervisor"`
 }
 
-func NewTfgridDirectoryNodeProof1() (TfgridDirectoryNodeProof1, error) {
+func NewProof() (Proof, error) {
 	const value = "{}"
-	var object TfgridDirectoryNodeProof1
+	var object Proof
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridDirectoryNodePublicIface1TypeEnum uint8
+type IfaceTypeEnum uint8
 
 const (
-	TfgridDirectoryNodePublicIface1TypeMacvlan TfgridDirectoryNodePublicIface1TypeEnum = iota
-	TfgridDirectoryNodePublicIface1TypeVlan
+	IfaceTypeMacvlan IfaceTypeEnum = iota
+	IfaceTypeVlan
 )
 
-func (e TfgridDirectoryNodePublicIface1TypeEnum) String() string {
+func (e IfaceTypeEnum) String() string {
 	switch e {
-	case TfgridDirectoryNodePublicIface1TypeMacvlan:
+	case IfaceTypeMacvlan:
 		return "macvlan"
-	case TfgridDirectoryNodePublicIface1TypeVlan:
+	case IfaceTypeVlan:
 		return "vlan"
 	}
 	return "UNKNOWN"
 }
 
-type TfgridDirectoryNodeResourcePrice1CurrencyEnum uint8
+type PriceCurrencyEnum uint8
 
 const (
-	TfgridDirectoryNodeResourcePrice1CurrencyEUR TfgridDirectoryNodeResourcePrice1CurrencyEnum = iota
-	TfgridDirectoryNodeResourcePrice1CurrencyUSD
-	TfgridDirectoryNodeResourcePrice1CurrencyTFT
-	TfgridDirectoryNodeResourcePrice1CurrencyAED
-	TfgridDirectoryNodeResourcePrice1CurrencyGBP
+	PriceCurrencyEUR PriceCurrencyEnum = iota
+	PriceCurrencyUSD
+	PriceCurrencyTFT
+	PriceCurrencyAED
+	PriceCurrencyGBP
 )
 
-func (e TfgridDirectoryNodeResourcePrice1CurrencyEnum) String() string {
+func (e PriceCurrencyEnum) String() string {
 	switch e {
-	case TfgridDirectoryNodeResourcePrice1CurrencyEUR:
+	case PriceCurrencyEUR:
 		return "EUR"
-	case TfgridDirectoryNodeResourcePrice1CurrencyUSD:
+	case PriceCurrencyUSD:
 		return "USD"
-	case TfgridDirectoryNodeResourcePrice1CurrencyTFT:
+	case PriceCurrencyTFT:
 		return "TFT"
-	case TfgridDirectoryNodeResourcePrice1CurrencyAED:
+	case PriceCurrencyAED:
 		return "AED"
-	case TfgridDirectoryNodeResourcePrice1CurrencyGBP:
+	case PriceCurrencyGBP:
 		return "GBP"
 	}
 	return "UNKNOWN"
diff --git a/tools/bcdb_mock/models/generated/phonebook/phonebook.go b/tools/bcdb_mock/models/generated/phonebook/phonebook.go
index e3d1fe7c..caeff12e 100644
--- a/tools/bcdb_mock/models/generated/phonebook/phonebook.go
+++ b/tools/bcdb_mock/models/generated/phonebook/phonebook.go
@@ -2,11 +2,12 @@ package phonebook
 
 import (
 	"encoding/json"
-	schema "github.com/threefoldtech/zos/pkg/schema"
 	"net"
+
+	schema "github.com/threefoldtech/zos/pkg/schema"
 )
 
-type TfgridPhonebookUser1 struct {
+type User struct {
 	ID          schema.ID `bson:"_id" json:"id"`
 	Name        string    `bson:"name" json:"name"`
 	Email       string    `bson:"email" json:"email"`
@@ -16,9 +17,9 @@ type TfgridPhonebookUser1 struct {
 	Signature   string    `bson:"signature" json:"signature"`
 }
 
-func NewTfgridPhonebookUser1() (TfgridPhonebookUser1, error) {
+func NewUser() (User, error) {
 	const value = "{}"
-	var object TfgridPhonebookUser1
+	var object User
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
diff --git a/tools/bcdb_mock/models/generated/workloads/workloads.go b/tools/bcdb_mock/models/generated/workloads/workloads.go
index 79d496b8..aed854f8 100644
--- a/tools/bcdb_mock/models/generated/workloads/workloads.go
+++ b/tools/bcdb_mock/models/generated/workloads/workloads.go
@@ -7,264 +7,271 @@ import (
 	schema "github.com/threefoldtech/zos/pkg/schema"
 )
 
-type TfgridWorkloadsReservation1 struct {
-	ID                  schema.ID                                     `bson:"_id" json:"id"`
-	Json                string                                        `bson:"json" json:"json"`
-	DataReservation     TfgridWorkloadsReservationData1               `bson:"data_reservation" json:"data_reservation"`
-	CustomerTid         int64                                         `bson:"customer_tid" json:"customer_tid"`
-	CustomerSignature   string                                        `bson:"customer_signature" json:"customer_signature"`
-	NextAction          TfgridWorkloadsReservation1NextActionEnum     `bson:"next_action" json:"next_action"`
-	SignaturesProvision []TfgridWorkloadsReservationSigningSignature1 `bson:"signatures_provision" json:"signatures_provision"`
-	SignaturesFarmer    []TfgridWorkloadsReservationSigningSignature1 `bson:"signatures_farmer" json:"signatures_farmer"`
-	SignaturesDelete    []TfgridWorkloadsReservationSigningSignature1 `bson:"signatures_delete" json:"signatures_delete"`
-	Epoch               schema.Date                                   `bson:"epoch" json:"epoch"`
-	Results             []TfgridWorkloadsReservationResult1           `bson:"results" json:"results"`
-}
-
-func NewTfgridWorkloadsReservation1() (TfgridWorkloadsReservation1, error) {
+type Reservation struct {
+	ID                  schema.ID          `bson:"_id" json:"id"`
+	Json                string             `bson:"json" json:"json"`
+	DataReservation     ReservationData    `bson:"data_reservation" json:"data_reservation"`
+	CustomerTid         int64              `bson:"customer_tid" json:"customer_tid"`
+	CustomerSignature   string             `bson:"customer_signature" json:"customer_signature"`
+	NextAction          NextActionEnum     `bson:"next_action" json:"next_action"`
+	SignaturesProvision []SigningSignature `bson:"signatures_provision" json:"signatures_provision"`
+	SignaturesFarmer    []SigningSignature `bson:"signatures_farmer" json:"signatures_farmer"`
+	SignaturesDelete    []SigningSignature `bson:"signatures_delete" json:"signatures_delete"`
+	Epoch               schema.Date        `bson:"epoch" json:"epoch"`
+	Results             []Result           `bson:"results" json:"results"`
+}
+
+func NewReservation() (Reservation, error) {
 	const value = "{\"json\": \"\"}"
-	var object TfgridWorkloadsReservation1
+	var object Reservation
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridWorkloadsReservationData1 struct {
-	Description             string                                    `bson:"description" json:"description"`
-	SigningRequestProvision TfgridWorkloadsReservationSigningRequest1 `bson:"signing_request_provision" json:"signing_request_provision"`
-	SigningRequestDelete    TfgridWorkloadsReservationSigningRequest1 `bson:"signing_request_delete" json:"signing_request_delete"`
-	Containers              []TfgridWorkloadsReservationContainer1    `bson:"containers" json:"containers"`
-	Volumes                 []TfgridWorkloadsReservationVolume1       `bson:"volumes" json:"volumes"`
-	Zdbs                    []TfgridWorkloadsReservationZdb1          `bson:"zdbs" json:"zdbs"`
-	Networks                []TfgridWorkloadsReservationNetwork1      `bson:"networks" json:"networks"`
-	Kubernetes              []TfgridWorkloadsReservationK8S1          `bson:"kubernetes" json:"kubernetes"`
-	ExpirationProvisioning  schema.Date                               `bson:"expiration_provisioning" json:"expiration_provisioning"`
-	ExpirationReservation   schema.Date                               `bson:"expiration_reservation" json:"expiration_reservation"`
+type ReservationData struct {
+	Description             string         `bson:"description" json:"description"`
+	SigningRequestProvision SigningRequest `bson:"signing_request_provision" json:"signing_request_provision"`
+	SigningRequestDelete    SigningRequest `bson:"signing_request_delete" json:"signing_request_delete"`
+	Containers              []Container    `bson:"containers" json:"containers"`
+	Volumes                 []Volume       `bson:"volumes" json:"volumes"`
+	Zdbs                    []ZDB          `bson:"zdbs" json:"zdbs"`
+	Networks                []Network      `bson:"networks" json:"networks"`
+	Kubernetes              []K8S          `bson:"kubernetes" json:"kubernetes"`
+	ExpirationProvisioning  schema.Date    `bson:"expiration_provisioning" json:"expiration_provisioning"`
+	ExpirationReservation   schema.Date    `bson:"expiration_reservation" json:"expiration_reservation"`
 }
 
-func NewTfgridWorkloadsReservationData1() (TfgridWorkloadsReservationData1, error) {
+func NewReservationData() (ReservationData, error) {
 	const value = "{\"description\": \"\"}"
-	var object TfgridWorkloadsReservationData1
+	var object ReservationData
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridWorkloadsReservationSigningRequest1 struct {
+type SigningRequest struct {
 	Signers   []int64 `bson:"signers" json:"signers"`
 	QuorumMin int64   `bson:"quorum_min" json:"quorum_min"`
 }
 
-func NewTfgridWorkloadsReservationSigningRequest1() (TfgridWorkloadsReservationSigningRequest1, error) {
+func NewSigningRequest() (SigningRequest, error) {
 	const value = "{}"
-	var object TfgridWorkloadsReservationSigningRequest1
+	var object SigningRequest
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridWorkloadsReservationSigningSignature1 struct {
+type SigningSignature struct {
 	Tid       int64       `bson:"tid" json:"tid"`
 	Signature string      `bson:"signature" json:"signature"`
 	Epoch     schema.Date `bson:"epoch" json:"epoch"`
 }
 
-func NewTfgridWorkloadsReservationSigningSignature1() (TfgridWorkloadsReservationSigningSignature1, error) {
+func NewSigningSignature() (SigningSignature, error) {
 	const value = "{}"
-	var object TfgridWorkloadsReservationSigningSignature1
+	var object SigningSignature
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridWorkloadsReservationContainer1 struct {
-	WorkloadId        int64                                          `bson:"workload_id" json:"workload_id"`
-	NodeId            string                                         `bson:"node_id" json:"node_id"`
-	Flist             string                                         `bson:"flist" json:"flist"`
-	HubUrl            string                                         `bson:"hub_url" json:"hub_url"`
-	Environment       map[string]interface{}                         `bson:"environment" json:"environment"`
-	SecretEnvironment map[string]interface{}                         `bson:"secret_environment" json:"secret_environment"`
-	Entrypoint        string                                         `bson:"entrypoint" json:"entrypoint"`
-	Interactive       bool                                           `bson:"interactive" json:"interactive"`
-	Volumes           []TfgridWorkloadsReservationContainerMount1    `bson:"volumes" json:"volumes"`
-	NetworkConnection []TfgridWorkloadsReservationNetworkConnection1 `bson:"network_connection" json:"network_connection"`
-	StatsAggregator   []TfgridWorkloadsReservationStatsaggregator1   `bson:"stats_aggregator" json:"stats_aggregator"`
-	Logs              []TfgridWorkloadsReservationLogs1              `bson:"logs" json:"logs"`
-	FarmerTid         int64                                          `bson:"farmer_tid" json:"farmer_tid"`
+type Container struct {
+	WorkloadId        int64               `bson:"workload_id" json:"workload_id"`
+	NodeId            string              `bson:"node_id" json:"node_id"`
+	Flist             string              `bson:"flist" json:"flist"`
+	HubUrl            string              `bson:"hub_url" json:"hub_url"`
+	Environment       map[string]string   `bson:"environment" json:"environment"`
+	SecretEnvironment map[string]string   `bson:"secret_environment" json:"secret_environment"`
+	Entrypoint        string              `bson:"entrypoint" json:"entrypoint"`
+	Interactive       bool                `bson:"interactive" json:"interactive"`
+	Volumes           []ContainerMount    `bson:"volumes" json:"volumes"`
+	NetworkConnection []NetworkConnection `bson:"network_connection" json:"network_connection"`
+	StatsAggregator   []StatsAggregator   `bson:"stats_aggregator" json:"stats_aggregator"`
+	Logs              []Logs              `bson:"logs" json:"logs"`
+	FarmerTid         int64               `bson:"farmer_tid" json:"farmer_tid"`
+	Capacity          ContainerCapacity   `bson:"capcity" json:"capacity"`
 }
 
-type TfgridWorkloadsReservationLogs1 struct {
-	Type string                               `bson:"type" json:"type"`
-	Data TfgridWorkloadsReservationLogsRedis1 `bson:"data" json:"data"`
+type ContainerCapacity struct {
+	Cpu    int64 `bson:"cpu" json:"cpu"`
+	Memory int64 `bson:"memory" json:"memory"`
 }
 
-type TfgridWorkloadsReservationLogsRedis1 struct {
+type Logs struct {
+	Type string    `bson:"type" json:"type"`
+	Data LogsRedis `bson:"data" json:"data"`
+}
+
+type LogsRedis struct {
 	Stdout string `bson:"stdout" json:"stdout"`
 	Stderr string `bson:"stderr" json:"stderr"`
 }
 
-func NewTfgridWorkloadsReservationContainer1() (TfgridWorkloadsReservationContainer1, error) {
+func NewContainer() (Container, error) {
 	const value = "{\"interactive\": true}"
-	var object TfgridWorkloadsReservationContainer1
+	var object Container
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridWorkloadsReservationContainerMount1 struct {
+type ContainerMount struct {
 	VolumeId   string `bson:"volume_id" json:"volume_id"`
 	Mountpoint string `bson:"mountpoint" json:"mountpoint"`
 }
 
-func NewTfgridWorkloadsReservationContainerMount1() (TfgridWorkloadsReservationContainerMount1, error) {
+func NewTfgridWorkloadsReservationContainerMount1() (ContainerMount, error) {
 	const value = "{}"
-	var object TfgridWorkloadsReservationContainerMount1
+	var object ContainerMount
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridWorkloadsReservationNetworkConnection1 struct {
+type NetworkConnection struct {
 	NetworkId string `bson:"network_id" json:"network_id"`
 	Ipaddress net.IP `bson:"ipaddress" json:"ipaddress"`
+	PublicIp6 bool   `bson:"public_ip6" json:"public_ip6"`
 }
 
-func NewTfgridWorkloadsReservationNetworkConnection1() (TfgridWorkloadsReservationNetworkConnection1, error) {
+func NewNetworkConnection() (NetworkConnection, error) {
 	const value = "{}"
-	var object TfgridWorkloadsReservationNetworkConnection1
+	var object NetworkConnection
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridWorkloadsReservationK8S1 struct {
-	WorkloadId      int64                                        `bson:"workload_id" json:"workload_id"`
-	NodeId          string                                       `bson:"node_id" json:"node_id"`
-	Size            int64                                        `bson:"size" json:"size"`
-	NetworkId       string                                       `bson:"network_id" json:"network_id"`
-	Ipaddress       net.IP                                       `bson:"ipaddress" json:"ipaddress"`
-	ClusterSecret   string                                       `bson:"cluster_secret" json:"cluster_secret"`
-	MasterIps       []net.IP                                     `bson:"master_ips" json:"master_ips"`
-	SshKeys         []string                                     `bson:"ssh_keys" json:"ssh_keys"`
-	StatsAggregator []TfgridWorkloadsReservationStatsaggregator1 `bson:"stats_aggregator" json:"stats_aggregator"`
-	FarmerTid       int64                                        `bson:"farmer_tid" json:"farmer_tid"`
+type K8S struct {
+	WorkloadId      int64             `bson:"workload_id" json:"workload_id"`
+	NodeId          string            `bson:"node_id" json:"node_id"`
+	Size            int64             `bson:"size" json:"size"`
+	NetworkId       string            `bson:"network_id" json:"network_id"`
+	Ipaddress       net.IP            `bson:"ipaddress" json:"ipaddress"`
+	ClusterSecret   string            `bson:"cluster_secret" json:"cluster_secret"`
+	MasterIps       []net.IP          `bson:"master_ips" json:"master_ips"`
+	SshKeys         []string          `bson:"ssh_keys" json:"ssh_keys"`
+	StatsAggregator []StatsAggregator `bson:"stats_aggregator" json:"stats_aggregator"`
+	FarmerTid       int64             `bson:"farmer_tid" json:"farmer_tid"`
 }
 
-func NewTfgridWorkloadsReservationK8S1() (TfgridWorkloadsReservationK8S1, error) {
+func NewK8S() (K8S, error) {
 	const value = "{}"
-	var object TfgridWorkloadsReservationK8S1
+	var object K8S
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridWorkloadsReservationNetwork1 struct {
-	Name             string                                       `bson:"name" json:"name"`
-	WorkloadId       int64                                        `bson:"workload_id" json:"workload_id"`
-	Iprange          schema.IPRange                               `bson:"iprange" json:"iprange"`
-	StatsAggregator  []TfgridWorkloadsReservationStatsaggregator1 `bson:"stats_aggregator" json:"stats_aggregator"`
-	NetworkResources []TfgridWorkloadsNetworkNetResource1         `bson:"network_resources" json:"network_resources"`
-	FarmerTid        int64                                        `bson:"farmer_tid" json:"farmer_tid"`
+type Network struct {
+	Name             string               `bson:"name" json:"name"`
+	WorkloadId       int64                `bson:"workload_id" json:"workload_id"`
+	Iprange          schema.IPRange       `bson:"iprange" json:"iprange"`
+	StatsAggregator  []StatsAggregator    `bson:"stats_aggregator" json:"stats_aggregator"`
+	NetworkResources []NetworkNetResource `bson:"network_resources" json:"network_resources"`
+	FarmerTid        int64                `bson:"farmer_tid" json:"farmer_tid"`
 }
 
-func NewTfgridWorkloadsReservationNetwork1() (TfgridWorkloadsReservationNetwork1, error) {
+func NewNetwork() (Network, error) {
 	const value = "{\"name\": \"\", \"iprange\": \"10.10.0.0/16\"}"
-	var object TfgridWorkloadsReservationNetwork1
+	var object Network
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridWorkloadsNetworkNetResource1 struct {
-	NodeId                       string                          `bson:"node_id" json:"node_id"`
-	WireguardPrivateKeyEncrypted string                          `bson:"wireguard_private_key_encrypted" json:"wireguard_private_key_encrypted"`
-	WireguardPublicKey           string                          `bson:"wireguard_public_key" json:"wireguard_public_key"`
-	WireguardListenPort          int64                           `bson:"wireguard_listen_port" json:"wireguard_listen_port"`
-	Iprange                      schema.IPRange                  `bson:"iprange" json:"iprange"`
-	Peers                        []TfgridWorkloadsWireguardPeer1 `bson:"peers" json:"peers"`
+type NetworkNetResource struct {
+	NodeId                       string          `bson:"node_id" json:"node_id"`
+	WireguardPrivateKeyEncrypted string          `bson:"wireguard_private_key_encrypted" json:"wireguard_private_key_encrypted"`
+	WireguardPublicKey           string          `bson:"wireguard_public_key" json:"wireguard_public_key"`
+	WireguardListenPort          int64           `bson:"wireguard_listen_port" json:"wireguard_listen_port"`
+	Iprange                      schema.IPRange  `bson:"iprange" json:"iprange"`
+	Peers                        []WireguardPeer `bson:"peers" json:"peers"`
 }
 
-func NewTfgridWorkloadsNetworkNetResource1() (TfgridWorkloadsNetworkNetResource1, error) {
+func NewNetworkNetResource() (NetworkNetResource, error) {
 	const value = "{\"wireguard_private_key_encrypted\": \"\", \"wireguard_public_key\": \"\", \"iprange\": \"10.10.10.0/24\"}"
-	var object TfgridWorkloadsNetworkNetResource1
+	var object NetworkNetResource
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridWorkloadsWireguardPeer1 struct {
+type WireguardPeer struct {
 	PublicKey      string           `bson:"public_key" json:"public_key"`
 	AllowedIprange []schema.IPRange `bson:"allowed_iprange" json:"allowed_iprange"`
 	Endpoint       string           `bson:"endpoint" json:"endpoint"`
 	Iprange        schema.IPRange   `bson:"iprange" json:"iprange"`
 }
 
-func NewTfgridWorkloadsWireguardPeer1() (TfgridWorkloadsWireguardPeer1, error) {
+func NewPeer() (WireguardPeer, error) {
 	const value = "{\"public_key\": \"\", \"allowed_iprange\": [], \"endpoint\": \"\", \"iprange\": \"10.10.11.0/24\"}"
-	var object TfgridWorkloadsWireguardPeer1
+	var object WireguardPeer
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridWorkloadsReservationResult1 struct {
-	Category   TfgridWorkloadsReservationResult1CategoryEnum `bson:"category" json:"category"`
-	WorkloadId string                                        `bson:"workload_id" json:"workload_id"`
-	DataJson   json.RawMessage                               `bson:"data_json" json:"data_json"`
-	Signature  string                                        `bson:"signature" json:"signature"`
-	State      TfgridWorkloadsReservationResult1StateEnum    `bson:"state" json:"state"`
-	Message    string                                        `bson:"message" json:"message"`
-	Epoch      schema.Date                                   `bson:"epoch" json:"epoch"`
-	NodeId     string                                        `bson:"node_id" json:"node_id"`
+type Result struct {
+	Category   ResultCategoryEnum `bson:"category" json:"category"`
+	WorkloadId string             `bson:"workload_id" json:"workload_id"`
+	DataJson   json.RawMessage    `bson:"data_json" json:"data_json"`
+	Signature  string             `bson:"signature" json:"signature"`
+	State      ResultStateEnum    `bson:"state" json:"state"`
+	Message    string             `bson:"message" json:"message"`
+	Epoch      schema.Date        `bson:"epoch" json:"epoch"`
+	NodeId     string             `bson:"node_id" json:"node_id"`
 }
 
-func NewTfgridWorkloadsReservationResult1() (TfgridWorkloadsReservationResult1, error) {
+func NewResult() (Result, error) {
 	const value = "{\"message\": \"\"}"
-	var object TfgridWorkloadsReservationResult1
+	var object Result
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridWorkloadsReservationStatsaggregator1 struct {
+type StatsAggregator struct {
 	Addr   string `bson:"addr" json:"addr"`
 	Port   int64  `bson:"port" json:"port"`
 	Secret string `bson:"secret" json:"secret"`
 }
 
-func NewTfgridWorkloadsReservationStatsaggregator1() (TfgridWorkloadsReservationStatsaggregator1, error) {
+func NewStatsAggregator() (StatsAggregator, error) {
 	const value = "{}"
-	var object TfgridWorkloadsReservationStatsaggregator1
+	var object StatsAggregator
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridWorkloadsReservationVolume1 struct {
-	WorkloadId      int64                                        `bson:"workload_id" json:"workload_id"`
-	NodeId          string                                       `bson:"node_id" json:"node_id"`
-	Size            int64                                        `bson:"size" json:"size"`
-	Type            TfgridWorkloadsReservationVolume1TypeEnum    `bson:"type" json:"type"`
-	StatsAggregator []TfgridWorkloadsReservationStatsaggregator1 `bson:"stats_aggregator" json:"stats_aggregator"`
-	FarmerTid       int64                                        `bson:"farmer_tid" json:"farmer_tid"`
+type Volume struct {
+	WorkloadId      int64             `bson:"workload_id" json:"workload_id"`
+	NodeId          string            `bson:"node_id" json:"node_id"`
+	Size            int64             `bson:"size" json:"size"`
+	Type            VolumeTypeEnum    `bson:"type" json:"type"`
+	StatsAggregator []StatsAggregator `bson:"stats_aggregator" json:"stats_aggregator"`
+	FarmerTid       int64             `bson:"farmer_tid" json:"farmer_tid"`
 }
 
-func NewTfgridWorkloadsReservationVolume1() (TfgridWorkloadsReservationVolume1, error) {
+func NewVolume() (Volume, error) {
 	const value = "{}"
-	var object TfgridWorkloadsReservationVolume1
+	var object Volume
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
@@ -273,194 +280,197 @@ func NewTfgridWorkloadsReservationVolume1() (TfgridWorkloadsReservationVolume1,
 
 // NOTE: this type has some manual changes
 // that need to be preserved between regenerations.
-type TfgridWorkloadsReservationWorkload1 struct {
-	WorkloadId string                                      `bson:"workload_id" json:"workload_id"`
-	User       string                                      `bson:"user" json:"user"`
-	Type       TfgridWorkloadsReservationWorkload1TypeEnum `bson:"type" json:"type"`
-	Content    interface{}                                 `bson:"content" json:"content"`
-	Created    schema.Date                                 `bson:"created" json:"created"`
-	Duration   int64                                       `bson:"duration" json:"duration"`
-	Signature  string                                      `bson:"signature" json:"signature"`
-	ToDelete   bool                                        `bson:"to_delete" json:"to_delete"`
-}
-
-func NewTfgridWorkloadsReservationWorkload1() (TfgridWorkloadsReservationWorkload1, error) {
+type ReservationWorkload struct {
+	WorkloadId string           `bson:"workload_id" json:"workload_id"`
+	User       string           `bson:"user" json:"user"`
+	Type       WorkloadTypeEnum `bson:"type" json:"type"`
+	Content    interface{}      `bson:"content" json:"content"`
+	Created    schema.Date      `bson:"created" json:"created"`
+	Duration   int64            `bson:"duration" json:"duration"`
+	Signature  string           `bson:"signature" json:"signature"`
+	ToDelete   bool             `bson:"to_delete" json:"to_delete"`
+}
+
+func NewReservationWorkload() (ReservationWorkload, error) {
 	const value = "{}"
-	var object TfgridWorkloadsReservationWorkload1
+	var object ReservationWorkload
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridWorkloadsReservationZdb1 struct {
-	WorkloadId      int64                                        `bson:"workload_id" json:"workload_id"`
-	NodeId          string                                       `bson:"node_id" json:"node_id"`
-	Size            int64                                        `bson:"size" json:"size"`
-	Mode            TfgridWorkloadsReservationZdb1ModeEnum       `bson:"mode" json:"mode"`
-	Password        string                                       `bson:"password" json:"password"`
-	DiskType        TfgridWorkloadsReservationZdb1DiskTypeEnum   `bson:"disk_type" json:"disk_type"`
-	Public          bool                                         `bson:"public" json:"public"`
-	StatsAggregator []TfgridWorkloadsReservationStatsaggregator1 `bson:"stats_aggregator" json:"stats_aggregator"`
-	FarmerTid       int64                                        `bson:"farmer_tid" json:"farmer_tid"`
+type ZDB struct {
+	WorkloadId      int64             `bson:"workload_id" json:"workload_id"`
+	NodeId          string            `bson:"node_id" json:"node_id"`
+	Size            int64             `bson:"size" json:"size"`
+	Mode            ZDBModeEnum       `bson:"mode" json:"mode"`
+	Password        string            `bson:"password" json:"password"`
+	DiskType        DiskTypeEnum      `bson:"disk_type" json:"disk_type"`
+	Public          bool              `bson:"public" json:"public"`
+	StatsAggregator []StatsAggregator `bson:"stats_aggregator" json:"stats_aggregator"`
+	FarmerTid       int64             `bson:"farmer_tid" json:"farmer_tid"`
 }
 
-func NewTfgridWorkloadsReservationZdb1() (TfgridWorkloadsReservationZdb1, error) {
+func NewZDB() (ZDB, error) {
 	const value = "{\"public\": false}"
-	var object TfgridWorkloadsReservationZdb1
+	var object ZDB
 	if err := json.Unmarshal([]byte(value), &object); err != nil {
 		return object, err
 	}
 	return object, nil
 }
 
-type TfgridWorkloadsReservationZdb1DiskTypeEnum uint8
+type DiskTypeEnum uint8
 
 const (
-	TfgridWorkloadsReservationZdb1DiskTypeHdd TfgridWorkloadsReservationZdb1DiskTypeEnum = iota
-	TfgridWorkloadsReservationZdb1DiskTypeSsd
+	DiskTypeHDD DiskTypeEnum = iota
+	DiskTypeSSD
 )
 
-func (e TfgridWorkloadsReservationZdb1DiskTypeEnum) String() string {
+func (e DiskTypeEnum) String() string {
 	switch e {
-	case TfgridWorkloadsReservationZdb1DiskTypeHdd:
+	case DiskTypeHDD:
 		return "hdd"
-	case TfgridWorkloadsReservationZdb1DiskTypeSsd:
+	case DiskTypeSSD:
 		return "ssd"
 	}
 	return "UNKNOWN"
 }
 
-type TfgridWorkloadsReservation1NextActionEnum uint8
+type NextActionEnum uint8
 
 const (
-	TfgridWorkloadsReservation1NextActionCreate TfgridWorkloadsReservation1NextActionEnum = iota
-	TfgridWorkloadsReservation1NextActionSign
-	TfgridWorkloadsReservation1NextActionPay
-	TfgridWorkloadsReservation1NextActionDeploy
-	TfgridWorkloadsReservation1NextActionDelete
-	TfgridWorkloadsReservation1NextActionInvalid
-	TfgridWorkloadsReservation1NextActionDeleted
+	NextActionCreate NextActionEnum = iota
+	NextActionSign
+	NextActionPay
+	NextActionDeploy
+	NextActionDelete
+	NextActionInvalid
+	NextActionDeleted
 )
 
-func (e TfgridWorkloadsReservation1NextActionEnum) String() string {
+func (e NextActionEnum) String() string {
 	switch e {
-	case TfgridWorkloadsReservation1NextActionCreate:
+	case NextActionCreate:
 		return "create"
-	case TfgridWorkloadsReservation1NextActionSign:
+	case NextActionSign:
 		return "sign"
-	case TfgridWorkloadsReservation1NextActionPay:
+	case NextActionPay:
 		return "pay"
-	case TfgridWorkloadsReservation1NextActionDeploy:
+	case NextActionDeploy:
 		return "deploy"
-	case TfgridWorkloadsReservation1NextActionDelete:
+	case NextActionDelete:
 		return "delete"
-	case TfgridWorkloadsReservation1NextActionInvalid:
+	case NextActionInvalid:
 		return "invalid"
-	case TfgridWorkloadsReservation1NextActionDeleted:
+	case NextActionDeleted:
 		return "deleted"
 	}
 	return "UNKNOWN"
 }
 
-type TfgridWorkloadsReservationResult1CategoryEnum uint8
+type ResultCategoryEnum uint8
 
 const (
-	TfgridWorkloadsReservationResult1CategoryZdb TfgridWorkloadsReservationResult1CategoryEnum = iota
-	TfgridWorkloadsReservationResult1CategoryContainer
-	TfgridWorkloadsReservationResult1CategoryNetwork
-	TfgridWorkloadsReservationResult1CategoryVolume
+	ResultCategoryZDB ResultCategoryEnum = iota
+	ResultCategoryContainer
+	ResultCategoryNetwork
+	ResultCategoryVolume
+	ResultCategoryK8S
 )
 
-func (e TfgridWorkloadsReservationResult1CategoryEnum) String() string {
+func (e ResultCategoryEnum) String() string {
 	switch e {
-	case TfgridWorkloadsReservationResult1CategoryZdb:
+	case ResultCategoryZDB:
 		return "zdb"
-	case TfgridWorkloadsReservationResult1CategoryContainer:
+	case ResultCategoryContainer:
 		return "container"
-	case TfgridWorkloadsReservationResult1CategoryNetwork:
+	case ResultCategoryNetwork:
 		return "network"
-	case TfgridWorkloadsReservationResult1CategoryVolume:
+	case ResultCategoryVolume:
 		return "volume"
+	case ResultCategoryK8S:
+		return "kubernetes"
 	}
 	return "UNKNOWN"
 }
 
-type TfgridWorkloadsReservationResult1StateEnum uint8
+type ResultStateEnum uint8
 
 const (
-	TfgridWorkloadsReservationResult1StateError TfgridWorkloadsReservationResult1StateEnum = iota
-	TfgridWorkloadsReservationResult1StateOk
-	TfgridWorkloadsReservationResult1StateDeleted
+	ResultStateError ResultStateEnum = iota
+	ResultStateOK
+	ResultStateDeleted
 )
 
-func (e TfgridWorkloadsReservationResult1StateEnum) String() string {
+func (e ResultStateEnum) String() string {
 	switch e {
-	case TfgridWorkloadsReservationResult1StateError:
+	case ResultStateError:
 		return "error"
-	case TfgridWorkloadsReservationResult1StateOk:
+	case ResultStateOK:
 		return "ok"
-	case TfgridWorkloadsReservationResult1StateDeleted:
+	case ResultStateDeleted:
 		return "deleted"
 	}
 	return "UNKNOWN"
 }
 
-type TfgridWorkloadsReservationVolume1TypeEnum uint8
+type VolumeTypeEnum uint8
 
 const (
-	TfgridWorkloadsReservationVolume1TypeHDD TfgridWorkloadsReservationVolume1TypeEnum = iota
-	TfgridWorkloadsReservationVolume1TypeSSD
+	VolumeTypeHDD VolumeTypeEnum = iota
+	VolumeTypeSSD
 )
 
-func (e TfgridWorkloadsReservationVolume1TypeEnum) String() string {
+func (e VolumeTypeEnum) String() string {
 	switch e {
-	case TfgridWorkloadsReservationVolume1TypeHDD:
+	case VolumeTypeHDD:
 		return "HDD"
-	case TfgridWorkloadsReservationVolume1TypeSSD:
+	case VolumeTypeSSD:
 		return "SSD"
 	}
 	return "UNKNOWN"
 }
 
-type TfgridWorkloadsReservationWorkload1TypeEnum uint8
+type WorkloadTypeEnum uint8
 
 const (
-	TfgridWorkloadsReservationWorkload1TypeZdb TfgridWorkloadsReservationWorkload1TypeEnum = iota
-	TfgridWorkloadsReservationWorkload1TypeContainer
-	TfgridWorkloadsReservationWorkload1TypeVolume
-	TfgridWorkloadsReservationWorkload1TypeNetwork
-	TfgridWorkloadsReservationWorkload1TypeKubernetes
+	WorkloadTypeZDB WorkloadTypeEnum = iota
+	WorkloadTypeContainer
+	WorkloadTypeVolume
+	WorkloadTypeNetwork
+	WorkloadTypeKubernetes
 )
 
-func (e TfgridWorkloadsReservationWorkload1TypeEnum) String() string {
+func (e WorkloadTypeEnum) String() string {
 	switch e {
-	case TfgridWorkloadsReservationWorkload1TypeZdb:
+	case WorkloadTypeZDB:
 		return "zdb"
-	case TfgridWorkloadsReservationWorkload1TypeContainer:
+	case WorkloadTypeContainer:
 		return "container"
-	case TfgridWorkloadsReservationWorkload1TypeVolume:
+	case WorkloadTypeVolume:
 		return "volume"
-	case TfgridWorkloadsReservationWorkload1TypeNetwork:
+	case WorkloadTypeNetwork:
 		return "network"
-	case TfgridWorkloadsReservationWorkload1TypeKubernetes:
+	case WorkloadTypeKubernetes:
 		return "kubernetes"
 	}
 	return "UNKNOWN"
 }
 
-type TfgridWorkloadsReservationZdb1ModeEnum uint8
+type ZDBModeEnum uint8
 
 const (
-	TfgridWorkloadsReservationZdb1ModeSeq TfgridWorkloadsReservationZdb1ModeEnum = iota
-	TfgridWorkloadsReservationZdb1ModeUser
+	ZDBModeSeq ZDBModeEnum = iota
+	ZDBModeUser
 )
 
-func (e TfgridWorkloadsReservationZdb1ModeEnum) String() string {
+func (e ZDBModeEnum) String() string {
 	switch e {
-	case TfgridWorkloadsReservationZdb1ModeSeq:
+	case ZDBModeSeq:
 		return "seq"
-	case TfgridWorkloadsReservationZdb1ModeUser:
+	case ZDBModeUser:
 		return "user"
 	}
 	return "UNKNOWN"
diff --git a/tools/bcdb_mock/models/schema/workloads/tfgrid_workloads_reservation_container_1.toml b/tools/bcdb_mock/models/schema/workloads/tfgrid_workloads_reservation_container_1.toml
index f5eec2a5..2950dd30 100644
--- a/tools/bcdb_mock/models/schema/workloads/tfgrid_workloads_reservation_container_1.toml
+++ b/tools/bcdb_mock/models/schema/workloads/tfgrid_workloads_reservation_container_1.toml
@@ -24,6 +24,7 @@ stats_aggregator = (LO) !tfgrid.workloads.reservation.statsaggregator.1
 #id of threebot who is the farmer
 farmer_tid = (I)
 logs = (LO) !tfgrid.workloads.reservation.container.logs.1
+capacity = (O) !tfgrid.workloads.reservation.container.capacity.1
 
 
 @url = tfgrid.workloads.reservation.container.mount.1
@@ -33,6 +34,7 @@ mountpoint = (S)
 @url = tfgrid.workloads.reservation.network.connection.1
 network_id = (S)
 ipaddress = (ipaddress)
+public_ip6 = (B)
 
 @url = tfgrid.workloads.reservation.container.logs.1
 type = (S)
@@ -41,3 +43,9 @@ data = (LO) !tfgrid.workloads.reservation.container.logsredis.1
 @url = tfgrid.workloads.reservation.container.logsredis.1
 stdout = (S)
 stderr = (S)
+
+@url = tfgrid.workloads.reservation.container.capacity.1
+# Number of vCPU
+cpu = (I)
+# memory in MiB
+memory = (I)
diff --git a/tools/bcdb_mock/models/utils.go b/tools/bcdb_mock/models/utils.go
index dbca8558..a2c67a5a 100644
--- a/tools/bcdb_mock/models/utils.go
+++ b/tools/bcdb_mock/models/utils.go
@@ -57,6 +57,11 @@ func PageFromRequest(r *http.Request) Pager {
 	return Page(page, size)
 }
 
+// Pages return number of pages based on the total number
+func Pages(p Pager, total int64) int64 {
+	return int64(math.Ceil(float64(total) / float64(*p.Limit)))
+}
+
 // NrPages compute the number of page of a collection
 func NrPages(total, pageSize int64) int64 {
 	return int64(math.Ceil(float64(total) / float64(pageSize)))
diff --git a/tools/bcdb_mock/pkg/directory/farms_handlers.go b/tools/bcdb_mock/pkg/directory/farms_handlers.go
index 68fd865c..f71d00ba 100644
--- a/tools/bcdb_mock/pkg/directory/farms_handlers.go
+++ b/tools/bcdb_mock/pkg/directory/farms_handlers.go
@@ -52,12 +52,12 @@ func (s *FarmAPI) listFarm(r *http.Request) (interface{}, mw.Response) {
 	}
 
 	pager := models.PageFromRequest(r)
-	farms, total, err := s.List(r.Context(), db, tid)
+	farms, total, err := s.List(r.Context(), db, tid, pager)
 	if err != nil {
 		return nil, mw.Error(err)
 	}
 
-	pages := fmt.Sprintf("%d", models.NrPages(total, *pager.Limit))
+	pages := fmt.Sprintf("%d", models.Pages(pager, total))
 	return farms, mw.Ok().WithHeader("Pages", pages)
 }
 
@@ -69,7 +69,7 @@ func parseOwnerID(r *http.Request) (tid int64, err error) {
 			return tid, fmt.Errorf("owner should be a integer")
 		}
 	}
-	log.Info().Msgf("owner id %d", tid)
+	log.Debug().Msgf("owner id %d", tid)
 	return tid, err
 }
 
diff --git a/tools/bcdb_mock/pkg/directory/node_handlers.go b/tools/bcdb_mock/pkg/directory/node_handlers.go
index 0b8e84a4..e366b145 100644
--- a/tools/bcdb_mock/pkg/directory/node_handlers.go
+++ b/tools/bcdb_mock/pkg/directory/node_handlers.go
@@ -8,7 +8,6 @@ import (
 	"github.com/rs/zerolog/log"
 
 	"github.com/threefoldtech/zos/pkg/capacity"
-	"github.com/threefoldtech/zos/pkg/network/types"
 	"github.com/threefoldtech/zos/tools/bcdb_mock/models"
 	generated "github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/directory"
 	"github.com/threefoldtech/zos/tools/bcdb_mock/mw"
@@ -69,16 +68,16 @@ func (s *NodeAPI) listNodes(r *http.Request) (interface{}, mw.Response) {
 		return nil, mw.Error(err)
 	}
 
-	pages := fmt.Sprintf("%d", models.NrPages(total, *pager.Limit))
+	pages := fmt.Sprintf("%d", models.Pages(pager, total))
 	return nodes, mw.Ok().WithHeader("Pages", pages)
 }
 
 func (s *NodeAPI) registerCapacity(r *http.Request) (interface{}, mw.Response) {
 	x := struct {
-		Capacity   generated.TfgridDirectoryNodeResourceAmount1 `json:"capacity,omitempty"`
-		DMI        dmi.DMI                                      `json:"dmi,omitempty"`
-		Disks      capacity.Disks                               `json:"disks,omitempty"`
-		Hypervisor []string                                     `json:"hypervisor,omitempty"`
+		Capacity   generated.ResourceAmount `json:"capacity,omitempty"`
+		DMI        dmi.DMI                  `json:"dmi,omitempty"`
+		Disks      capacity.Disks           `json:"disks,omitempty"`
+		Hypervisor []string                 `json:"hypervisor,omitempty"`
 	}{}
 
 	defer r.Body.Close()
@@ -106,7 +105,7 @@ func (s *NodeAPI) registerIfaces(r *http.Request) (interface{}, mw.Response) {
 
 	defer r.Body.Close()
 
-	var input []generated.TfgridDirectoryNodeIface1
+	var input []generated.Iface
 	if err := json.NewDecoder(r.Body).Decode(&input); err != nil {
 		return nil, mw.BadRequest(err)
 	}
@@ -121,25 +120,16 @@ func (s *NodeAPI) registerIfaces(r *http.Request) (interface{}, mw.Response) {
 }
 
 func (s *NodeAPI) configurePublic(r *http.Request) (interface{}, mw.Response) {
-	var iface types.PubIface
+	var iface generated.PublicIface
 
 	defer r.Body.Close()
 	if err := json.NewDecoder(r.Body).Decode(&iface); err != nil {
 		return nil, mw.BadRequest(err)
 	}
 
-	cfg := generated.TfgridDirectoryNodePublicIface1{
-		Gw4:    iface.GW4,
-		Gw6:    iface.GW6,
-		Ipv4:   iface.IPv4.ToSchema(),
-		Ipv6:   iface.IPv6.ToSchema(),
-		Master: iface.Master,
-		Type:   generated.TfgridDirectoryNodePublicIface1TypeMacvlan,
-	}
-
 	nodeID := mux.Vars(r)["node_id"]
 	db := mw.Database(r)
-	if err := s.SetPublicConfig(r.Context(), db, nodeID, cfg); err != nil {
+	if err := s.SetPublicConfig(r.Context(), db, nodeID, iface); err != nil {
 		return nil, mw.Error(err)
 	}
 
@@ -172,7 +162,7 @@ func (s *NodeAPI) updateUptimeHandler(r *http.Request) (interface{}, mw.Response
 	defer r.Body.Close()
 
 	input := struct {
-		Uptime uint64
+		Uptime uint64 `json:"uptime"`
 	}{}
 	if err := json.NewDecoder(r.Body).Decode(&input); err != nil {
 		return nil, mw.BadRequest(err)
@@ -193,7 +183,7 @@ func (s *NodeAPI) updateReservedResources(r *http.Request) (interface{}, mw.Resp
 	//return nil, mw.Error(fmt.Errorf("not implemented"))
 	defer r.Body.Close()
 
-	var resources generated.TfgridDirectoryNodeResourceAmount1
+	var resources generated.ResourceAmount
 
 	if err := json.NewDecoder(r.Body).Decode(&resources); err != nil {
 		return nil, mw.BadRequest(err)
diff --git a/tools/bcdb_mock/pkg/directory/nodes_store.go b/tools/bcdb_mock/pkg/directory/nodes_store.go
index 5aba4a5a..f6ccaad7 100644
--- a/tools/bcdb_mock/pkg/directory/nodes_store.go
+++ b/tools/bcdb_mock/pkg/directory/nodes_store.go
@@ -140,11 +140,11 @@ func (s *NodeAPI) Add(ctx context.Context, db *mongo.Database, node directory.No
 	return directory.NodeCreate(ctx, db, node)
 }
 
-func (s *NodeAPI) updateTotalCapacity(ctx context.Context, db *mongo.Database, nodeID string, capacity generated.TfgridDirectoryNodeResourceAmount1) error {
+func (s *NodeAPI) updateTotalCapacity(ctx context.Context, db *mongo.Database, nodeID string, capacity generated.ResourceAmount) error {
 	return directory.NodeUpdateTotalResources(ctx, db, nodeID, capacity)
 }
 
-func (s *NodeAPI) updateReservedCapacity(ctx context.Context, db *mongo.Database, nodeID string, capacity generated.TfgridDirectoryNodeResourceAmount1) error {
+func (s *NodeAPI) updateReservedCapacity(ctx context.Context, db *mongo.Database, nodeID string, capacity generated.ResourceAmount) error {
 	return directory.NodeUpdateUsedResources(ctx, db, nodeID, capacity)
 }
 
@@ -155,7 +155,7 @@ func (s *NodeAPI) updateUptime(ctx context.Context, db *mongo.Database, nodeID s
 // StoreProof stores node hardware proof
 func (s *NodeAPI) StoreProof(ctx context.Context, db *mongo.Database, nodeID string, dmi dmi.DMI, disks capacity.Disks, hypervisor []string) error {
 	var err error
-	proof := generated.TfgridDirectoryNodeProof1{
+	proof := generated.Proof{
 		Created:    schema.Date{Time: time.Now()},
 		Hypervisor: hypervisor,
 	}
@@ -184,12 +184,12 @@ func (s *NodeAPI) StoreProof(ctx context.Context, db *mongo.Database, nodeID str
 }
 
 // SetInterfaces updates node interfaces
-func (s *NodeAPI) SetInterfaces(ctx context.Context, db *mongo.Database, nodeID string, ifaces []generated.TfgridDirectoryNodeIface1) error {
+func (s *NodeAPI) SetInterfaces(ctx context.Context, db *mongo.Database, nodeID string, ifaces []generated.Iface) error {
 	return directory.NodeSetInterfaces(ctx, db, nodeID, ifaces)
 }
 
 // SetPublicConfig sets node public config
-func (s *NodeAPI) SetPublicConfig(ctx context.Context, db *mongo.Database, nodeID string, cfg generated.TfgridDirectoryNodePublicIface1) error {
+func (s *NodeAPI) SetPublicConfig(ctx context.Context, db *mongo.Database, nodeID string, cfg generated.PublicIface) error {
 	node, err := s.Get(ctx, db, nodeID, false)
 	if err != nil {
 		return err
diff --git a/tools/bcdb_mock/pkg/directory/types/farm.go b/tools/bcdb_mock/pkg/directory/types/farm.go
index e714de4a..4d996d1d 100644
--- a/tools/bcdb_mock/pkg/directory/types/farm.go
+++ b/tools/bcdb_mock/pkg/directory/types/farm.go
@@ -23,7 +23,7 @@ const (
 )
 
 //Farm mongo db wrapper for generated TfgridDirectoryFarm
-type Farm generated.TfgridDirectoryFarm1
+type Farm generated.Farm
 
 // Validate validates farm object
 func (f *Farm) Validate() error {
diff --git a/tools/bcdb_mock/pkg/directory/types/node.go b/tools/bcdb_mock/pkg/directory/types/node.go
index bea0d796..a5239806 100644
--- a/tools/bcdb_mock/pkg/directory/types/node.go
+++ b/tools/bcdb_mock/pkg/directory/types/node.go
@@ -20,7 +20,7 @@ const (
 )
 
 // Node model
-type Node generated.TfgridDirectoryNode2
+type Node generated.Node
 
 // Validate node
 func (n *Node) Validate() error {
@@ -38,7 +38,7 @@ func (n *Node) Validate() error {
 
 	// Unfortunately, jsx schema does not support nil types
 	// so this is the only way to check if values are not set
-	empty := generated.TfgridDirectoryLocation1{}
+	empty := generated.Location{}
 	if n.Location == empty {
 		return fmt.Errorf("location is required")
 	}
@@ -169,13 +169,13 @@ func NodeCreate(ctx context.Context, db *mongo.Database, node Node) (schema.ID,
 
 	node.ID = id
 	if node.Proofs == nil {
-		node.Proofs = make([]generated.TfgridDirectoryNodeProof1, 0)
+		node.Proofs = make([]generated.Proof, 0)
 	}
 
 	node.Updated = schema.Date{Time: time.Now()}
 	col := db.Collection(NodeCollection)
-	result := col.FindOneAndUpdate(ctx, filter, bson.M{"$set": node}, options.FindOneAndUpdate().SetUpsert(true))
-	return id, result.Err()
+	_, err = col.UpdateOne(ctx, filter, bson.M{"$set": node}, options.Update().SetUpsert(true))
+	return id, err
 }
 
 func nodeUpdate(ctx context.Context, db *mongo.Database, nodeID string, value interface{}) error {
@@ -194,17 +194,17 @@ func nodeUpdate(ctx context.Context, db *mongo.Database, nodeID string, value in
 }
 
 // NodeUpdateTotalResources sets the node total resources
-func NodeUpdateTotalResources(ctx context.Context, db *mongo.Database, nodeID string, capacity generated.TfgridDirectoryNodeResourceAmount1) error {
+func NodeUpdateTotalResources(ctx context.Context, db *mongo.Database, nodeID string, capacity generated.ResourceAmount) error {
 	return nodeUpdate(ctx, db, nodeID, bson.M{"total_resources": capacity})
 }
 
 // NodeUpdateReservedResources sets the node reserved resources
-func NodeUpdateReservedResources(ctx context.Context, db *mongo.Database, nodeID string, capacity generated.TfgridDirectoryNodeResourceAmount1) error {
+func NodeUpdateReservedResources(ctx context.Context, db *mongo.Database, nodeID string, capacity generated.ResourceAmount) error {
 	return nodeUpdate(ctx, db, nodeID, bson.M{"reserved_resources": capacity})
 }
 
 // NodeUpdateUsedResources sets the node total resources
-func NodeUpdateUsedResources(ctx context.Context, db *mongo.Database, nodeID string, capacity generated.TfgridDirectoryNodeResourceAmount1) error {
+func NodeUpdateUsedResources(ctx context.Context, db *mongo.Database, nodeID string, capacity generated.ResourceAmount) error {
 	return nodeUpdate(ctx, db, nodeID, bson.M{"used_resources": capacity})
 }
 
@@ -217,14 +217,14 @@ func NodeUpdateUptime(ctx context.Context, db *mongo.Database, nodeID string, up
 }
 
 // NodeSetInterfaces updates node interfaces
-func NodeSetInterfaces(ctx context.Context, db *mongo.Database, nodeID string, ifaces []generated.TfgridDirectoryNodeIface1) error {
+func NodeSetInterfaces(ctx context.Context, db *mongo.Database, nodeID string, ifaces []generated.Iface) error {
 	return nodeUpdate(ctx, db, nodeID, bson.M{
 		"ifaces": ifaces,
 	})
 }
 
 // NodeSetPublicConfig sets node public config
-func NodeSetPublicConfig(ctx context.Context, db *mongo.Database, nodeID string, cfg generated.TfgridDirectoryNodePublicIface1) error {
+func NodeSetPublicConfig(ctx context.Context, db *mongo.Database, nodeID string, cfg generated.PublicIface) error {
 	return nodeUpdate(ctx, db, nodeID, bson.M{
 		"public_config": cfg,
 	})
@@ -238,7 +238,7 @@ func NodeSetWGPorts(ctx context.Context, db *mongo.Database, nodeID string, port
 }
 
 // NodePushProof push proof to node
-func NodePushProof(ctx context.Context, db *mongo.Database, nodeID string, proof generated.TfgridDirectoryNodeProof1) error {
+func NodePushProof(ctx context.Context, db *mongo.Database, nodeID string, proof generated.Proof) error {
 	if nodeID == "" {
 		return fmt.Errorf("invalid node id")
 	}
diff --git a/tools/bcdb_mock/pkg/phonebook/types/user.go b/tools/bcdb_mock/pkg/phonebook/types/user.go
index b4eb4754..fdc7512f 100644
--- a/tools/bcdb_mock/pkg/phonebook/types/user.go
+++ b/tools/bcdb_mock/pkg/phonebook/types/user.go
@@ -32,7 +32,7 @@ var (
 )
 
 // User type
-type User generated.TfgridPhonebookUser1
+type User generated.User
 
 // Encode user data for signing
 func (u *User) Encode() []byte {
diff --git a/tools/bcdb_mock/pkg/workloads/reservation.go b/tools/bcdb_mock/pkg/workloads/reservation.go
index 31006cfb..ee227287 100644
--- a/tools/bcdb_mock/pkg/workloads/reservation.go
+++ b/tools/bcdb_mock/pkg/workloads/reservation.go
@@ -41,10 +41,10 @@ func (a *API) create(r *http.Request) (interface{}, mw.Response) {
 	// we make sure those arrays are initialized correctly
 	// this will make updating the document in place much easier
 	// in later stages
-	reservation.SignaturesProvision = make([]generated.TfgridWorkloadsReservationSigningSignature1, 0)
-	reservation.SignaturesDelete = make([]generated.TfgridWorkloadsReservationSigningSignature1, 0)
-	reservation.SignaturesFarmer = make([]generated.TfgridWorkloadsReservationSigningSignature1, 0)
-	reservation.Results = make([]generated.TfgridWorkloadsReservationResult1, 0)
+	reservation.SignaturesProvision = make([]generated.SigningSignature, 0)
+	reservation.SignaturesDelete = make([]generated.SigningSignature, 0)
+	reservation.SignaturesFarmer = make([]generated.SigningSignature, 0)
+	reservation.Results = make([]generated.Result, 0)
 
 	reservation, err := a.pipeline(reservation, nil)
 	if err != nil {
@@ -165,15 +165,15 @@ func (a *API) list(r *http.Request) (interface{}, mw.Response) {
 func (a *API) queued(ctx context.Context, db *mongo.Database, nodeID string, limit int64) ([]types.Workload, error) {
 
 	type intermediate struct {
-		WorkloadID string                                                `bson:"workload_id" json:"workload_id"`
-		User       string                                                `bson:"user" json:"user"`
-		Type       generated.TfgridWorkloadsReservationWorkload1TypeEnum `bson:"type" json:"type"`
-		Content    bson.Raw                                              `bson:"content" json:"content"`
-		Created    schema.Date                                           `bson:"created" json:"created"`
-		Duration   int64                                                 `bson:"duration" json:"duration"`
-		Signature  string                                                `bson:"signature" json:"signature"`
-		ToDelete   bool                                                  `bson:"to_delete" json:"to_delete"`
-		NodeID     string                                                `json:"node_id" bson:"node_id"`
+		WorkloadID string                     `bson:"workload_id" json:"workload_id"`
+		User       string                     `bson:"user" json:"user"`
+		Type       generated.WorkloadTypeEnum `bson:"type" json:"type"`
+		Content    bson.Raw                   `bson:"content" json:"content"`
+		Created    schema.Date                `bson:"created" json:"created"`
+		Duration   int64                      `bson:"duration" json:"duration"`
+		Signature  string                     `bson:"signature" json:"signature"`
+		ToDelete   bool                       `bson:"to_delete" json:"to_delete"`
+		NodeID     string                     `json:"node_id" bson:"node_id"`
 	}
 
 	workloads := make([]types.Workload, 0)
@@ -199,7 +199,7 @@ func (a *API) queued(ctx context.Context, db *mongo.Database, nodeID string, lim
 			return workloads, err
 		}
 
-		obj := generated.TfgridWorkloadsReservationWorkload1{
+		obj := generated.ReservationWorkload{
 			WorkloadId: wl.WorkloadID,
 			User:       wl.User,
 			Type:       wl.Type,
@@ -210,36 +210,36 @@ func (a *API) queued(ctx context.Context, db *mongo.Database, nodeID string, lim
 			ToDelete:  wl.ToDelete,
 		}
 		switch wl.Type {
-		case generated.TfgridWorkloadsReservationWorkload1TypeContainer:
-			var data generated.TfgridWorkloadsReservationContainer1
+		case generated.WorkloadTypeContainer:
+			var data generated.Container
 			if err := bson.Unmarshal(wl.Content, &data); err != nil {
 				return nil, err
 			}
 			obj.Content = data
 
-		case generated.TfgridWorkloadsReservationWorkload1TypeVolume:
-			var data generated.TfgridWorkloadsReservationVolume1
+		case generated.WorkloadTypeVolume:
+			var data generated.Volume
 			if err := bson.Unmarshal(wl.Content, &data); err != nil {
 				return nil, err
 			}
 			obj.Content = data
 
-		case generated.TfgridWorkloadsReservationWorkload1TypeZdb:
-			var data generated.TfgridWorkloadsReservationZdb1
+		case generated.WorkloadTypeZDB:
+			var data generated.ZDB
 			if err := bson.Unmarshal(wl.Content, &data); err != nil {
 				return nil, err
 			}
 			obj.Content = data
 
-		case generated.TfgridWorkloadsReservationWorkload1TypeNetwork:
-			var data generated.TfgridWorkloadsReservationNetwork1
+		case generated.WorkloadTypeNetwork:
+			var data generated.Network
 			if err := bson.Unmarshal(wl.Content, &data); err != nil {
 				return nil, err
 			}
 			obj.Content = data
 
-		case generated.TfgridWorkloadsReservationWorkload1TypeKubernetes:
-			var data generated.TfgridWorkloadsReservationK8S1
+		case generated.WorkloadTypeKubernetes:
+			var data generated.K8S
 			if err := bson.Unmarshal(wl.Content, &data); err != nil {
 				return nil, err
 			}
@@ -247,8 +247,8 @@ func (a *API) queued(ctx context.Context, db *mongo.Database, nodeID string, lim
 		}
 
 		workloads = append(workloads, types.Workload{
-			NodeID:                              wl.NodeID,
-			TfgridWorkloadsReservationWorkload1: obj,
+			NodeID:              wl.NodeID,
+			ReservationWorkload: obj,
 		})
 	}
 
@@ -472,7 +472,7 @@ func (a *API) workloadPutDeleted(r *http.Request) (interface{}, mw.Response) {
 		}
 	}
 
-	result.State = generated.TfgridWorkloadsReservationResult1StateDeleted
+	result.State = generated.ResultStateDeleted
 
 	if err := types.ResultPush(r.Context(), db, rid, *result); err != nil {
 		return nil, mw.Error(err)
@@ -492,7 +492,7 @@ func (a *API) workloadPutDeleted(r *http.Request) (interface{}, mw.Response) {
 		return nil, nil
 	}
 
-	if err := types.ReservationSetNextAction(r.Context(), db, reservation.ID, generated.TfgridWorkloadsReservation1NextActionDeleted); err != nil {
+	if err := types.ReservationSetNextAction(r.Context(), db, reservation.ID, generated.NextActionDeleted); err != nil {
 		return nil, mw.Error(err)
 	}
 
@@ -501,7 +501,7 @@ func (a *API) workloadPutDeleted(r *http.Request) (interface{}, mw.Response) {
 
 func (a *API) signProvision(r *http.Request) (interface{}, mw.Response) {
 	defer r.Body.Close()
-	var signature generated.TfgridWorkloadsReservationSigningSignature1
+	var signature generated.SigningSignature
 
 	if err := json.NewDecoder(r.Body).Decode(&signature); err != nil {
 		return nil, mw.BadRequest(err)
@@ -526,7 +526,7 @@ func (a *API) signProvision(r *http.Request) (interface{}, mw.Response) {
 		return nil, mw.NotFound(err)
 	}
 
-	if reservation.NextAction != generated.TfgridWorkloadsReservation1NextActionSign {
+	if reservation.NextAction != generated.NextActionSign {
 		return nil, mw.UnAuthorized(fmt.Errorf("reservation not expecting signatures"))
 	}
 
@@ -562,7 +562,7 @@ func (a *API) signProvision(r *http.Request) (interface{}, mw.Response) {
 		return nil, mw.Error(err)
 	}
 
-	if reservation.NextAction == generated.TfgridWorkloadsReservation1NextActionDeploy {
+	if reservation.NextAction == generated.NextActionDeploy {
 		types.WorkloadPush(r.Context(), db, reservation.Workloads("")...)
 	}
 
@@ -571,7 +571,7 @@ func (a *API) signProvision(r *http.Request) (interface{}, mw.Response) {
 
 func (a *API) signDelete(r *http.Request) (interface{}, mw.Response) {
 	defer r.Body.Close()
-	var signature generated.TfgridWorkloadsReservationSigningSignature1
+	var signature generated.SigningSignature
 
 	if err := json.NewDecoder(r.Body).Decode(&signature); err != nil {
 		return nil, mw.BadRequest(err)
@@ -628,11 +628,11 @@ func (a *API) signDelete(r *http.Request) (interface{}, mw.Response) {
 		return nil, mw.Error(err)
 	}
 
-	if reservation.NextAction != generated.TfgridWorkloadsReservation1NextActionDelete {
+	if reservation.NextAction != generated.NextActionDelete {
 		return nil, mw.Created()
 	}
 
-	if err := types.ReservationSetNextAction(r.Context(), db, reservation.ID, generated.TfgridWorkloadsReservation1NextActionDelete); err != nil {
+	if err := types.ReservationSetNextAction(r.Context(), db, reservation.ID, generated.NextActionDelete); err != nil {
 		return nil, mw.Error(err)
 	}
 
diff --git a/tools/bcdb_mock/pkg/workloads/setup.go b/tools/bcdb_mock/pkg/workloads/setup.go
index a286dd12..1f12db01 100644
--- a/tools/bcdb_mock/pkg/workloads/setup.go
+++ b/tools/bcdb_mock/pkg/workloads/setup.go
@@ -29,11 +29,6 @@ func Setup(parent *mux.Router, db *mongo.Database) error {
 	reservations.HandleFunc("/workloads/{gwid:\\d+-\\d+}", mw.AsHandlerFunc(api.workloadGet)).Methods(http.MethodGet)
 	reservations.HandleFunc("/workloads/{gwid:\\d+-\\d+}/{node_id}", mw.AsHandlerFunc(api.workloadPutResult)).Methods(http.MethodPut)
 	reservations.HandleFunc("/workloads/{gwid:\\d+-\\d+}/{node_id}", mw.AsHandlerFunc(api.workloadPutDeleted)).Methods(http.MethodDelete)
-	// router.HandleFunc("/reservations/{node_id}/poll", nodeStore.Requires("node_id", resStore.poll)).Methods("GET")
-	// router.HandleFunc("/reservations/{id}", resStore.get).Methods("GET")
-	// router.HandleFunc("/reservations/{id}", resStore.putResult).Methods("PUT")
-	// router.HandleFunc("/reservations/{id}/deleted", resStore.putDeleted).Methods("PUT")
-	// router.HandleFunc("/reservations/{id}", resStore.delete).Methods("DELETE")
 
 	return nil
 }
diff --git a/tools/bcdb_mock/pkg/workloads/types/pipeline.go b/tools/bcdb_mock/pkg/workloads/types/pipeline.go
index f6344c33..3bd0303e 100644
--- a/tools/bcdb_mock/pkg/workloads/types/pipeline.go
+++ b/tools/bcdb_mock/pkg/workloads/types/pipeline.go
@@ -93,8 +93,8 @@ func (p *Pipeline) checkDeleteSignatures() bool {
 
 // Next gets new modified reservation, and true if the reservation has changed from the input
 func (p *Pipeline) Next() (Reservation, bool) {
-	if p.r.NextAction == generated.TfgridWorkloadsReservation1NextActionDelete ||
-		p.r.NextAction == generated.TfgridWorkloadsReservation1NextActionDeleted {
+	if p.r.NextAction == generated.NextActionDelete ||
+		p.r.NextAction == generated.NextActionDeleted {
 		return p.r, false
 	}
 
@@ -104,7 +104,7 @@ func (p *Pipeline) Next() (Reservation, bool) {
 		// reservation has expired
 		// set its status (next action) to delete
 		log.Debug().Int64("id", int64(p.r.ID)).Msg("expired or to be deleted")
-		p.r.NextAction = generated.TfgridWorkloadsReservation1NextActionDelete
+		p.r.NextAction = generated.NextActionDelete
 		return p.r, true
 	}
 
@@ -112,31 +112,31 @@ func (p *Pipeline) Next() (Reservation, bool) {
 	modified := false
 	for {
 		switch p.r.NextAction {
-		case generated.TfgridWorkloadsReservation1NextActionCreate:
+		case generated.NextActionCreate:
 			// provision expiration, if exceeded, the node should not
 			// try to deploy this reservation.
 			if time.Until(p.r.DataReservation.ExpirationProvisioning.Time) <= 0 {
 				// exceeded
 				// TODO: I think this should be set to "delete" not "invalid"
 				log.Debug().Int64("id", int64(p.r.ID)).Msg("expired")
-				p.r.NextAction = generated.TfgridWorkloadsReservation1NextActionInvalid
+				p.r.NextAction = generated.NextActionInvalid
 			} else {
 				log.Debug().Int64("id", int64(p.r.ID)).Msg("ready to sign")
-				p.r.NextAction = generated.TfgridWorkloadsReservation1NextActionSign
+				p.r.NextAction = generated.NextActionSign
 			}
-		case generated.TfgridWorkloadsReservation1NextActionSign:
+		case generated.NextActionSign:
 			// this stage will not change unless all
 			if p.checkProvisionSignatures() {
 				log.Debug().Int64("id", int64(p.r.ID)).Msg("ready to pay")
-				p.r.NextAction = generated.TfgridWorkloadsReservation1NextActionPay
+				p.r.NextAction = generated.NextActionPay
 			}
-		case generated.TfgridWorkloadsReservation1NextActionPay:
+		case generated.NextActionPay:
 			// TODO: here we should actually start the payment process
 			// but this is not implemented yet, so now we just need to move
 			// to deploy
 			log.Debug().Int64("id", int64(p.r.ID)).Msg("ready to deploy")
-			p.r.NextAction = generated.TfgridWorkloadsReservation1NextActionDeploy
-		case generated.TfgridWorkloadsReservation1NextActionDeploy:
+			p.r.NextAction = generated.NextActionDeploy
+		case generated.NextActionDeploy:
 			//nothing to do
 			log.Debug().Int64("id", int64(p.r.ID)).Msg("let's deploy")
 		}
diff --git a/tools/bcdb_mock/pkg/workloads/types/reservation.go b/tools/bcdb_mock/pkg/workloads/types/reservation.go
index 5c062600..eebe7145 100644
--- a/tools/bcdb_mock/pkg/workloads/types/reservation.go
+++ b/tools/bcdb_mock/pkg/workloads/types/reservation.go
@@ -28,19 +28,19 @@ const (
 
 const (
 	// Create action
-	Create = generated.TfgridWorkloadsReservation1NextActionCreate
+	Create = generated.NextActionCreate
 	// Sign action
-	Sign = generated.TfgridWorkloadsReservation1NextActionSign
+	Sign = generated.NextActionSign
 	// Pay action
-	Pay = generated.TfgridWorkloadsReservation1NextActionPay
+	Pay = generated.NextActionPay
 	// Deploy action
-	Deploy = generated.TfgridWorkloadsReservation1NextActionDeploy
+	Deploy = generated.NextActionDeploy
 	// Delete action
-	Delete = generated.TfgridWorkloadsReservation1NextActionDelete
+	Delete = generated.NextActionDelete
 	// Invalid action
-	Invalid = generated.TfgridWorkloadsReservation1NextActionInvalid
+	Invalid = generated.NextActionInvalid
 	// Deleted action
-	Deleted = generated.TfgridWorkloadsReservation1NextActionDeleted
+	Deleted = generated.NextActionDeleted
 )
 
 // ReservationFilter type
@@ -59,7 +59,7 @@ func (f ReservationFilter) WithIDGE(id schema.ID) ReservationFilter {
 }
 
 // WithNextAction filter reservations with next action
-func (f ReservationFilter) WithNextAction(action generated.TfgridWorkloadsReservation1NextActionEnum) ReservationFilter {
+func (f ReservationFilter) WithNextAction(action generated.NextActionEnum) ReservationFilter {
 	return append(f, bson.E{
 		Key: "next_action", Value: action,
 	})
@@ -126,7 +126,7 @@ func (f ReservationFilter) Count(ctx context.Context, db *mongo.Database) (int64
 }
 
 // Reservation is a wrapper around generated type
-type Reservation generated.TfgridWorkloadsReservation1
+type Reservation generated.Reservation
 
 // Validate that the reservation is valid
 func (r *Reservation) validate() error {
@@ -138,7 +138,7 @@ func (r *Reservation) validate() error {
 		return fmt.Errorf("customer_signature is required")
 	}
 
-	var data generated.TfgridWorkloadsReservationData1
+	var data generated.ReservationData
 
 	if err := json.Unmarshal([]byte(r.Json), &data); err != nil {
 		return errors.Wrap(err, "invalid json data on reservation")
@@ -227,7 +227,7 @@ func (r *Reservation) Expired() bool {
 }
 
 // IsAny checks if the reservation status is any of the given status
-func (r *Reservation) IsAny(status ...generated.TfgridWorkloadsReservation1NextActionEnum) bool {
+func (r *Reservation) IsAny(status ...generated.NextActionEnum) bool {
 	for _, s := range status {
 		if r.NextAction == s {
 			return true
@@ -255,7 +255,7 @@ func (r *Reservation) AllDeleted() bool {
 	for _, wl := range r.Workloads("") {
 		result := r.ResultOf(wl.WorkloadId)
 		if result == nil ||
-			result.State != generated.TfgridWorkloadsReservationResult1StateDeleted {
+			result.State != generated.ResultStateDeleted {
 			return false
 		}
 	}
@@ -273,10 +273,10 @@ func (r *Reservation) Workloads(nodeID string) []Workload {
 			continue
 		}
 		workload := Workload{
-			TfgridWorkloadsReservationWorkload1: generated.TfgridWorkloadsReservationWorkload1{
+			ReservationWorkload: generated.ReservationWorkload{
 				WorkloadId: fmt.Sprintf("%d-%d", r.ID, wl.WorkloadId),
 				User:       fmt.Sprint(r.CustomerTid),
-				Type:       generated.TfgridWorkloadsReservationWorkload1TypeContainer,
+				Type:       generated.WorkloadTypeContainer,
 				Content:    wl,
 				Created:    r.Epoch,
 				Duration:   int64(data.ExpirationReservation.Sub(r.Epoch.Time).Seconds()),
@@ -293,10 +293,10 @@ func (r *Reservation) Workloads(nodeID string) []Workload {
 			continue
 		}
 		workload := Workload{
-			TfgridWorkloadsReservationWorkload1: generated.TfgridWorkloadsReservationWorkload1{
+			ReservationWorkload: generated.ReservationWorkload{
 				WorkloadId: fmt.Sprintf("%d-%d", r.ID, wl.WorkloadId),
 				User:       fmt.Sprint(r.CustomerTid),
-				Type:       generated.TfgridWorkloadsReservationWorkload1TypeVolume,
+				Type:       generated.WorkloadTypeVolume,
 				Content:    wl,
 				Created:    r.Epoch,
 				Duration:   int64(data.ExpirationReservation.Sub(r.Epoch.Time).Seconds()),
@@ -313,10 +313,10 @@ func (r *Reservation) Workloads(nodeID string) []Workload {
 			continue
 		}
 		workload := Workload{
-			TfgridWorkloadsReservationWorkload1: generated.TfgridWorkloadsReservationWorkload1{
+			ReservationWorkload: generated.ReservationWorkload{
 				WorkloadId: fmt.Sprintf("%d-%d", r.ID, wl.WorkloadId),
 				User:       fmt.Sprint(r.CustomerTid),
-				Type:       generated.TfgridWorkloadsReservationWorkload1TypeZdb,
+				Type:       generated.WorkloadTypeZDB,
 				Content:    wl,
 				Created:    r.Epoch,
 				Duration:   int64(data.ExpirationReservation.Sub(r.Epoch.Time).Seconds()),
@@ -333,10 +333,10 @@ func (r *Reservation) Workloads(nodeID string) []Workload {
 			continue
 		}
 		workload := Workload{
-			TfgridWorkloadsReservationWorkload1: generated.TfgridWorkloadsReservationWorkload1{
+			ReservationWorkload: generated.ReservationWorkload{
 				WorkloadId: fmt.Sprintf("%d-%d", r.ID, wl.WorkloadId),
 				User:       fmt.Sprint(r.CustomerTid),
-				Type:       generated.TfgridWorkloadsReservationWorkload1TypeKubernetes,
+				Type:       generated.WorkloadTypeKubernetes,
 				Content:    wl,
 				Created:    r.Epoch,
 				Duration:   int64(data.ExpirationReservation.Sub(r.Epoch.Time).Seconds()),
@@ -360,10 +360,10 @@ func (r *Reservation) Workloads(nodeID string) []Workload {
 			// result is what is gonna be visible. We need to (may be) change
 			// the workload id to have the network resource index
 			workload := Workload{
-				TfgridWorkloadsReservationWorkload1: generated.TfgridWorkloadsReservationWorkload1{
+				ReservationWorkload: generated.ReservationWorkload{
 					WorkloadId: fmt.Sprintf("%d-%d", r.ID, wl.WorkloadId),
 					User:       fmt.Sprint(r.CustomerTid),
-					Type:       generated.TfgridWorkloadsReservationWorkload1TypeNetwork,
+					Type:       generated.WorkloadTypeNetwork,
 					Content:    wl,
 					Created:    r.Epoch,
 					Duration:   int64(data.ExpirationReservation.Sub(r.Epoch.Time).Seconds()),
@@ -395,7 +395,7 @@ func ReservationCreate(ctx context.Context, db *mongo.Database, r Reservation) (
 }
 
 // ReservationSetNextAction update the reservation next action in db
-func ReservationSetNextAction(ctx context.Context, db *mongo.Database, id schema.ID, action generated.TfgridWorkloadsReservation1NextActionEnum) error {
+func ReservationSetNextAction(ctx context.Context, db *mongo.Database, id schema.ID, action generated.NextActionEnum) error {
 	var filter ReservationFilter
 	filter = filter.WithID(id)
 
@@ -424,7 +424,7 @@ const (
 )
 
 //ReservationPushSignature push signature to reservation
-func ReservationPushSignature(ctx context.Context, db *mongo.Database, id schema.ID, mode SignatureMode, signature generated.TfgridWorkloadsReservationSigningSignature1) error {
+func ReservationPushSignature(ctx context.Context, db *mongo.Database, id schema.ID, mode SignatureMode, signature generated.SigningSignature) error {
 
 	var filter ReservationFilter
 	filter = filter.WithID(id)
@@ -456,8 +456,8 @@ func ReservationPushSignature(ctx context.Context, db *mongo.Database, id schema
 
 // Workload is a wrapper around generated TfgridWorkloadsReservationWorkload1 type
 type Workload struct {
-	generated.TfgridWorkloadsReservationWorkload1 `bson:",inline"`
-	NodeID                                        string `json:"node_id" bson:"node_id"`
+	generated.ReservationWorkload `bson:",inline"`
+	NodeID                        string `json:"node_id" bson:"node_id"`
 }
 
 // QueueFilter for workloads in temporary queue
@@ -495,7 +495,7 @@ func WorkloadPop(ctx context.Context, db *mongo.Database, id string) error {
 }
 
 // Result is a wrapper around TfgridWorkloadsReservationResult1 type
-type Result generated.TfgridWorkloadsReservationResult1
+type Result generated.Result
 
 func (r *Result) encode() ([]byte, error) {
 	buf := &bytes.Buffer{}
diff --git a/tools/client/client.go b/tools/client/client.go
new file mode 100644
index 00000000..dc92a78c
--- /dev/null
+++ b/tools/client/client.go
@@ -0,0 +1,115 @@
+package client
+
+import (
+	"fmt"
+	"net/url"
+
+	"github.com/threefoldtech/zos/pkg/capacity"
+	"github.com/threefoldtech/zos/pkg/capacity/dmi"
+	"github.com/threefoldtech/zos/pkg/schema"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/directory"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/phonebook"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/workloads"
+)
+
+// Client structure
+type Client struct {
+	Phonebook Phonebook
+	Directory Directory
+	Workloads Workloads
+}
+
+// Directory API interface
+type Directory interface {
+	FarmRegister(farm directory.Farm) (schema.ID, error)
+	FarmList(tid schema.ID, page *Pager) (farms []directory.Farm, err error)
+	FarmGet(id schema.ID) (farm directory.Farm, err error)
+
+	NodeRegister(node directory.Node) error
+	NodeList(filter NodeFilter) (nodes []directory.Node, err error)
+	NodeGet(id string, proofs bool) (node directory.Node, err error)
+
+	NodeSetInterfaces(id string, ifaces []directory.Iface) error
+	NodeSetPorts(id string, ports []uint) error
+	NodeSetPublic(id string, pub directory.PublicIface) error
+
+	//TODO: this method call uses types from zos that is not generated
+	//from the schema. Which is wrong imho.
+	NodeSetCapacity(
+		id string,
+		resources directory.ResourceAmount,
+		dmiInfo dmi.DMI,
+		disksInfo capacity.Disks,
+		hypervisor []string,
+	) error
+
+	NodeUpdateUptime(id string, uptime uint64) error
+	NodeUpdateUsedResources(id string, amount directory.ResourceAmount) error
+}
+
+// Phonebook interface
+type Phonebook interface {
+	Create(user phonebook.User) (schema.ID, error)
+	List(name, email string, page *Pager) (output []phonebook.User, err error)
+	Get(id schema.ID) (phonebook.User, error)
+	// Update() #TODO
+	Validate(id schema.ID, message, signature string) (bool, error)
+}
+
+// Workloads interface
+type Workloads interface {
+	Create(reservation workloads.Reservation) (id schema.ID, err error)
+	List(page *Pager) (reservation []workloads.Reservation, err error)
+	Get(id schema.ID) (reservation workloads.Reservation, err error)
+
+	SignProvision(id schema.ID, user schema.ID, signature string) error
+	SignDelete(id schema.ID, user schema.ID, signature string) error
+
+	Workloads(nodeID string, from uint64) ([]workloads.ReservationWorkload, error)
+	WorkloadGet(gwid string) (result workloads.ReservationWorkload, err error)
+	WorkloadPutResult(nodeID, gwid string, result workloads.Result) error
+	WorkloadPutDeleted(nodeID, gwid string) error
+}
+
+// Pager for listing
+type Pager struct {
+	p int
+	s int
+}
+
+func (p *Pager) apply(v url.Values) {
+	if p == nil {
+		return
+	}
+
+	if p.p < 1 {
+		p.p = 1
+	}
+
+	if p.s == 0 {
+		p.s = 10
+	}
+
+	v.Set("page", fmt.Sprint(p.p))
+	v.Set("size", fmt.Sprint(p.s))
+}
+
+// Page returns a pager
+func Page(page, size int) *Pager {
+	return &Pager{p: page, s: size}
+}
+
+// NewClient creates a new client
+func NewClient(u string) (*Client, error) {
+	h, err := newHTTPClient(u)
+	if err != nil {
+		return nil, err
+	}
+	cl := &Client{
+		Phonebook: &httpPhonebook{h},
+		Directory: &httpDirectory{h},
+		Workloads: &httpWorkloads{h},
+	}
+
+	return cl, nil
+}
diff --git a/tools/client/directory.go b/tools/client/directory.go
new file mode 100644
index 00000000..6ee1a107
--- /dev/null
+++ b/tools/client/directory.go
@@ -0,0 +1,112 @@
+package client
+
+import (
+	"fmt"
+	"net/http"
+	"net/url"
+
+	"github.com/threefoldtech/zos/pkg/capacity"
+	"github.com/threefoldtech/zos/pkg/capacity/dmi"
+	"github.com/threefoldtech/zos/pkg/schema"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/directory"
+)
+
+type httpDirectory struct {
+	*httpClient
+}
+
+func (d *httpDirectory) FarmRegister(farm directory.Farm) (schema.ID, error) {
+	var output struct {
+		ID schema.ID `json:"id"`
+	}
+
+	err := d.post(d.url("farms"), farm, &output, http.StatusCreated)
+	return output.ID, err
+}
+
+func (d *httpDirectory) FarmList(tid schema.ID, page *Pager) (farms []directory.Farm, err error) {
+	query := url.Values{}
+	page.apply(query)
+	if tid > 0 {
+		query.Set("owner", fmt.Sprint(tid))
+	}
+
+	err = d.get(d.url("farms"), query, &farms, http.StatusOK)
+	return
+}
+
+func (d *httpDirectory) FarmGet(id schema.ID) (farm directory.Farm, err error) {
+	err = d.get(d.url("farms", fmt.Sprint(id)), nil, &farm, http.StatusOK)
+	return
+}
+
+func (d *httpDirectory) NodeRegister(node directory.Node) error {
+	return d.post(d.url("nodes"), node, nil, http.StatusCreated)
+}
+
+func (d *httpDirectory) NodeList(filter NodeFilter) (nodes []directory.Node, err error) {
+	query := url.Values{}
+	filter.Apply(query)
+	err = d.get(d.url("nodes"), query, &nodes, http.StatusOK)
+	return
+}
+
+func (d *httpDirectory) NodeGet(id string, proofs bool) (node directory.Node, err error) {
+	query := url.Values{}
+	query.Set("proofs", fmt.Sprint(proofs))
+	err = d.get(d.url("nodes", id), query, &node, http.StatusOK)
+	return
+}
+
+func (d *httpDirectory) NodeSetInterfaces(id string, ifaces []directory.Iface) error {
+	return d.post(d.url("nodes", id, "interfaces"), ifaces, nil, http.StatusCreated)
+}
+
+func (d *httpDirectory) NodeSetPorts(id string, ports []uint) error {
+	var input struct {
+		P []uint `json:"ports"`
+	}
+	input.P = ports
+
+	return d.post(d.url("nodes", id, "ports"), input, nil, http.StatusOK)
+}
+
+func (d *httpDirectory) NodeSetPublic(id string, pub directory.PublicIface) error {
+	return d.post(d.url("nodes", id, "configure_public"), pub, nil, http.StatusCreated)
+}
+
+func (d *httpDirectory) NodeSetCapacity(
+	id string,
+	resources directory.ResourceAmount,
+	dmiInfo dmi.DMI,
+	disksInfo capacity.Disks,
+	hypervisor []string) error {
+
+	payload := struct {
+		Capacity   directory.ResourceAmount `json:"capacity"`
+		DMI        dmi.DMI                  `json:"dmi"`
+		Disks      capacity.Disks           `json:"disks"`
+		Hypervisor []string                 `json:"hypervisor"`
+	}{
+		Capacity:   resources,
+		DMI:        dmiInfo,
+		Disks:      disksInfo,
+		Hypervisor: hypervisor,
+	}
+
+	return d.post(d.url("nodes", id, "capacity"), payload, nil, http.StatusOK)
+}
+
+func (d *httpDirectory) NodeUpdateUptime(id string, uptime uint64) error {
+	input := struct {
+		U uint64 `json:"uptime"`
+	}{
+		U: uptime,
+	}
+
+	return d.post(d.url("nodes", id, "uptime"), input, nil, http.StatusOK)
+}
+
+func (d *httpDirectory) NodeUpdateUsedResources(id string, amount directory.ResourceAmount) error {
+	return d.post(d.url("nodes", id, "used_resources"), amount, nil, http.StatusOK)
+}
diff --git a/tools/client/filter.go b/tools/client/filter.go
new file mode 100644
index 00000000..4f5d8ed8
--- /dev/null
+++ b/tools/client/filter.go
@@ -0,0 +1,96 @@
+package client
+
+import (
+	"fmt"
+	"net/url"
+)
+
+// NodeFilter used to build a query for node list
+type NodeFilter struct {
+	farm    *int64
+	country *string
+	city    *string
+	cru     *int64
+	mru     *int64
+	sru     *int64
+	hru     *int64
+	proofs  *bool
+}
+
+// WithFarm filter with farm
+func (n NodeFilter) WithFarm(id int64) NodeFilter {
+	n.farm = &id
+	return n
+}
+
+//WithCountry filter with country
+func (n NodeFilter) WithCountry(country string) NodeFilter {
+	n.country = &country
+	return n
+}
+
+//WithCity filter with city
+func (n NodeFilter) WithCity(city string) NodeFilter {
+	n.city = &city
+	return n
+}
+
+//WithCRU filter with CRU
+func (n NodeFilter) WithCRU(cru int64) NodeFilter {
+	n.cru = &cru
+	return n
+}
+
+// WithMRU filter with mru
+func (n NodeFilter) WithMRU(sru int64) NodeFilter {
+	n.sru = &sru
+	return n
+}
+
+// WithHRU filter with HRU
+func (n NodeFilter) WithHRU(hru int64) NodeFilter {
+	n.hru = &hru
+	return n
+}
+
+// WithProofs filter with proofs
+func (n NodeFilter) WithProofs(proofs bool) NodeFilter {
+	n.proofs = &proofs
+	return n
+}
+
+// Apply fills query
+func (n NodeFilter) Apply(query url.Values) {
+
+	if n.farm != nil {
+		query.Set("farm", fmt.Sprint(*n.farm))
+	}
+
+	if n.country != nil {
+		query.Set("country", *n.country)
+	}
+
+	if n.city != nil {
+		query.Set("city", *n.city)
+	}
+
+	if n.cru != nil {
+		query.Set("cru", fmt.Sprint(*n.cru))
+	}
+
+	if n.mru != nil {
+		query.Set("mru", fmt.Sprint(*n.mru))
+	}
+
+	if n.sru != nil {
+		query.Set("sru", fmt.Sprint(*n.sru))
+	}
+
+	if n.hru != nil {
+		query.Set("hru", fmt.Sprint(*n.hru))
+	}
+
+	if n.proofs != nil {
+		query.Set("proofs", fmt.Sprint(*n.proofs))
+	}
+}
diff --git a/tools/client/http.go b/tools/client/http.go
new file mode 100644
index 00000000..135b7ce6
--- /dev/null
+++ b/tools/client/http.go
@@ -0,0 +1,147 @@
+package client
+
+import (
+	"bytes"
+	"encoding/json"
+	"fmt"
+	"io/ioutil"
+	"net/http"
+	"net/url"
+	"path/filepath"
+
+	"github.com/pkg/errors"
+)
+
+const (
+	httpContentType = "application/json"
+)
+
+var (
+	successCodes = []int{
+		http.StatusOK,
+		http.StatusCreated,
+	}
+)
+
+type httpClient struct {
+	u  *url.URL
+	cl http.Client
+}
+
+func newHTTPClient(raw string) (*httpClient, error) {
+	u, err := url.Parse(raw)
+	if err != nil {
+		return nil, errors.Wrap(err, "invalid url")
+	}
+
+	return &httpClient{u: u}, nil
+}
+
+func (c *httpClient) url(p ...string) string {
+	b := *c.u
+	b.Path = filepath.Join(b.Path, filepath.Join(p...))
+
+	return b.String()
+}
+
+func (c *httpClient) process(response *http.Response, output interface{}, expect ...int) error {
+	defer response.Body.Close()
+
+	if len(expect) == 0 {
+		expect = successCodes
+	}
+
+	in := func(i int, l []int) bool {
+		for _, x := range l {
+			if x == i {
+				return true
+			}
+		}
+		return false
+	}
+
+	dec := json.NewDecoder(response.Body)
+	if !in(response.StatusCode, expect) {
+		var output struct {
+			E string `json:"error"`
+		}
+
+		if err := dec.Decode(&output); err != nil {
+			return errors.Wrapf(err, "failed to load error while processing invalid return code of: %s", response.StatusCode)
+		}
+
+		return fmt.Errorf("%s: %s", response.Status, output.E)
+	}
+
+	if output == nil {
+		//discard output
+		ioutil.ReadAll(response.Body)
+		return nil
+	}
+
+	if err := dec.Decode(output); err != nil {
+		return errors.Wrap(err, "failed to load output")
+	}
+
+	return nil
+}
+
+func (c *httpClient) post(u string, input interface{}, output interface{}, expect ...int) error {
+	var buf bytes.Buffer
+	if err := json.NewEncoder(&buf).Encode(input); err != nil {
+		return errors.Wrap(err, "failed to serialize request body")
+	}
+
+	response, err := c.cl.Post(u, httpContentType, &buf)
+	if err != nil {
+		return errors.Wrap(err, "failed to send request")
+	}
+
+	return c.process(response, output, expect...)
+}
+
+func (c *httpClient) put(u string, input interface{}, output interface{}, expect ...int) error {
+	var buf bytes.Buffer
+	if err := json.NewEncoder(&buf).Encode(input); err != nil {
+		return errors.Wrap(err, "failed to serialize request body")
+	}
+	req, err := http.NewRequest(http.MethodPut, u, &buf)
+	if err != nil {
+		return errors.Wrap(err, "failed to build request")
+	}
+	response, err := c.cl.Do(req)
+	if err != nil {
+		return errors.Wrap(err, "failed to send request")
+	}
+
+	return c.process(response, output, expect...)
+}
+
+func (c *httpClient) get(u string, query url.Values, output interface{}, expect ...int) error {
+	if len(query) > 0 {
+		u = fmt.Sprintf("%s?%s", u, query.Encode())
+	}
+
+	response, err := c.cl.Get(u)
+	if err != nil {
+		return errors.Wrap(err, "failed to send request")
+	}
+
+	return c.process(response, output, expect...)
+}
+
+func (c *httpClient) delete(u string, query url.Values, output interface{}, expect ...int) error {
+	if len(query) > 0 {
+		u = fmt.Sprintf("%s?%s", u, query.Encode())
+	}
+	req, err := http.NewRequest(http.MethodDelete, u, nil)
+	if err != nil {
+		return errors.Wrap(err, "failed to build request")
+	}
+	response, err := c.cl.Do(req)
+	if err != nil {
+		return errors.Wrap(err, "failed to send request")
+	}
+
+	return c.process(response, output, expect...)
+}
diff --git a/tools/client/phonebook.go b/tools/client/phonebook.go
new file mode 100644
index 00000000..87ac72e3
--- /dev/null
+++ b/tools/client/phonebook.go
@@ -0,0 +1,64 @@
+package client
+
+import (
+	"fmt"
+	"net/http"
+	"net/url"
+
+	"github.com/threefoldtech/zos/pkg/schema"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/phonebook"
+)
+
+type httpPhonebook struct {
+	*httpClient
+}
+
+func (p *httpPhonebook) Create(user phonebook.User) (schema.ID, error) {
+	var out phonebook.User
+	if err := p.post(p.url("users"), user, &out); err != nil {
+		return 0, err
+	}
+
+	return out.ID, nil
+}
+
+func (p *httpPhonebook) List(name, email string, page *Pager) (output []phonebook.User, err error) {
+	query := url.Values{}
+	page.apply(query)
+	if len(name) != 0 {
+		query.Set("name", name)
+	}
+	if len(email) != 0 {
+		query.Set("email", email)
+	}
+
+	err = p.get(p.url("users"), query, &output, http.StatusOK)
+
+	return
+}
+
+func (p *httpPhonebook) Get(id schema.ID) (user phonebook.User, err error) {
+	err = p.get(p.url("users", fmt.Sprint(id)), nil, &user, http.StatusOK)
+	return
+}
+
+// Validate the signature of this message for the user, signature and message are hex encoded
+func (p *httpPhonebook) Validate(id schema.ID, message, signature string) (bool, error) {
+	var input struct {
+		S string `json:"signature"`
+		M string `json:"payload"`
+	}
+	input.S = signature
+	input.M = message
+
+	var output struct {
+		V bool `json:"is_valid"`
+	}
+
+	err := p.post(p.url("users", fmt.Sprint(id), "validate"), input, &output, http.StatusOK)
+	if err != nil {
+		return false, err
+	}
+
+	return output.V, nil
+}
diff --git a/tools/client/signer.go b/tools/client/signer.go
new file mode 100644
index 00000000..df87f012
--- /dev/null
+++ b/tools/client/signer.go
@@ -0,0 +1,90 @@
+package client
+
+import (
+	"bytes"
+	"encoding/hex"
+	"encoding/json"
+	"fmt"
+
+	"github.com/threefoldtech/zos/pkg/crypto"
+	"github.com/threefoldtech/zos/pkg/identity"
+	"github.com/threefoldtech/zos/pkg/schema"
+)
+
+// Signer is a utility to easily sign payloads
+type Signer struct {
+	pair identity.KeyPair
+}
+
+// NewSigner create a signer with a seed
+func NewSigner(seed []byte) (*Signer, error) {
+	pair, err := identity.FromSeed(seed)
+	if err != nil {
+		return nil, err
+	}
+
+	return &Signer{pair: pair}, nil
+}
+
+// NewSignerFromFile loads signer from a seed file
+func NewSignerFromFile(path string) (*Signer, error) {
+	pair, err := identity.LoadKeyPair(path)
+	if err != nil {
+		return nil, err
+	}
+
+	return &Signer{pair: pair}, nil
+}
+
+// SignHex like sign, but return message and signature in hex encoded format
+func (s *Signer) SignHex(o ...interface{}) (string, string, error) {
+	msg, sig, err := s.Sign(o...)
+	if err != nil {
+		return "", "", err
+	}
+
+	return hex.EncodeToString(msg), hex.EncodeToString(sig), nil
+}
+
+// Sign constructs a message from all it's arguments then sign it
+func (s *Signer) Sign(o ...interface{}) ([]byte, []byte, error) {
+	var buf bytes.Buffer
+	for _, x := range o {
+		switch x := x.(type) {
+		case nil:
+		case string:
+			buf.WriteString(x)
+		case fmt.Stringer:
+			buf.WriteString(x.String())
+		case []byte:
+			buf.Write(x)
+		case json.RawMessage:
+			buf.Write(x)
+		case byte:
+			buf.WriteString(fmt.Sprint(x))
+		// all int types
+		case schema.ID:
+			buf.WriteString(fmt.Sprint(x))
+		case int:
+			buf.WriteString(fmt.Sprint(x))
+		case int8:
+			buf.WriteString(fmt.Sprint(x))
+		case int16:
+			buf.WriteString(fmt.Sprint(x))
+		case int32:
+			buf.WriteString(fmt.Sprint(x))
+		case int64:
+			buf.WriteString(fmt.Sprint(x))
+		// all float types
+		case float32:
+			buf.WriteString(fmt.Sprint(x))
+		case float64:
+			buf.WriteString(fmt.Sprint(x))
+		default:
+			return nil, nil, fmt.Errorf("unsupported type")
+		}
+	}
+	msg := buf.Bytes()
+	sig, err := crypto.Sign(s.pair.PrivateKey, msg)
+	return msg, sig, err
+}
diff --git a/tools/client/workloads.go b/tools/client/workloads.go
new file mode 100644
index 00000000..3219a7c9
--- /dev/null
+++ b/tools/client/workloads.go
@@ -0,0 +1,146 @@
+package client
+
+import (
+	"encoding/json"
+	"fmt"
+	"net/http"
+	"net/url"
+
+	"github.com/threefoldtech/zos/pkg/schema"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/workloads"
+)
+
+type httpWorkloads struct {
+	*httpClient
+}
+
+func (w *httpWorkloads) Create(reservation workloads.Reservation) (id schema.ID, err error) {
+	err = w.post(w.url("reservations"), reservation, &id, http.StatusCreated)
+	return
+}
+
+func (w *httpWorkloads) List(page *Pager) (reservation []workloads.Reservation, err error) {
+	query := url.Values{}
+	page.apply(query)
+
+	err = w.get(w.url("reservations"), query, &reservation, http.StatusOK)
+	return
+}
+
+func (w *httpWorkloads) Get(id schema.ID) (reservation workloads.Reservation, err error) {
+	err = w.get(w.url("reservations", fmt.Sprint(id)), nil, &reservation, http.StatusOK)
+	return
+}
+
+func (w *httpWorkloads) SignProvision(id schema.ID, user schema.ID, signature string) error {
+	return w.post(
+		w.url("reservations", fmt.Sprint(id), "sign", "provision"),
+		workloads.SigningSignature{
+			Tid:       int64(user),
+			Signature: signature,
+		},
+		nil,
+		http.StatusCreated,
+	)
+}
+
+func (w *httpWorkloads) SignDelete(id schema.ID, user schema.ID, signature string) error {
+	return w.post(
+		w.url("reservations", fmt.Sprint(id), "sign", "delete"),
+		workloads.SigningSignature{
+			Tid:       int64(user),
+			Signature: signature,
+		},
+		nil,
+		http.StatusCreated,
+	)
+}
+
+type intermediateWL struct {
+	workloads.ReservationWorkload
+	Content json.RawMessage `json:"content"`
+}
+
+func (wl *intermediateWL) Workload() (result workloads.ReservationWorkload, err error) {
+	result = wl.ReservationWorkload
+	switch wl.Type {
+	case workloads.WorkloadTypeContainer:
+		var o workloads.Container
+		if err := json.Unmarshal(wl.Content, &o); err != nil {
+			return result, err
+		}
+		result.Content = o
+	case workloads.WorkloadTypeKubernetes:
+		var o workloads.K8S
+		if err := json.Unmarshal(wl.Content, &o); err != nil {
+			return result, err
+		}
+		result.Content = o
+	case workloads.WorkloadTypeNetwork:
+		var o workloads.Network
+		if err := json.Unmarshal(wl.Content, &o); err != nil {
+			return result, err
+		}
+		result.Content = o
+	case workloads.WorkloadTypeVolume:
+		var o workloads.Volume
+		if err := json.Unmarshal(wl.Content, &o); err != nil {
+			return result, err
+		}
+		result.Content = o
+	case workloads.WorkloadTypeZDB:
+		var o workloads.ZDB
+		if err := json.Unmarshal(wl.Content, &o); err != nil {
+			return result, err
+		}
+		result.Content = o
+	default:
+		return result, fmt.Errorf("unknown workload type")
+	}
+
+	return
+}
+
+func (w *httpWorkloads) Workloads(nodeID string, from uint64) ([]workloads.ReservationWorkload, error) {
+	query := url.Values{}
+	query.Set("from", fmt.Sprint(from))
+
+	var list []intermediateWL
+
+	err := w.get(
+		w.url("reservations", "workloads", nodeID),
+		query,
+		&list,
+		http.StatusOK,
+	)
+	if err != nil {
+		return nil, err
+	}
+	results := make([]workloads.ReservationWorkload, 0, len(list))
+	for _, i := range list {
+		wl, err := i.Workload()
+		if err != nil {
+			return nil, err
+		}
+		results = append(results, wl)
+	}
+	return results, err
+}
+
+func (w *httpWorkloads) WorkloadGet(gwid string) (result workloads.ReservationWorkload, err error) {
+	var output intermediateWL
+	err = w.get(w.url("reservations", "workloads", gwid), nil, &output, http.StatusOK)
+	if err != nil {
+		return
+	}
+
+	return output.Workload()
+}
+
+func (w *httpWorkloads) WorkloadPutResult(nodeID, gwid string, result workloads.Result) error {
+	return w.put(w.url("reservations", "workloads", gwid, nodeID), result, nil, http.StatusCreated)
+}
+
+func (w *httpWorkloads) WorkloadPutDeleted(nodeID, gwid string) error {
+	return w.delete(w.url("reservations", "workloads", gwid, nodeID), nil, nil, http.StatusOK)
+}
diff --git a/tools/tffarmer/farm.go b/tools/tffarmer/farm.go
index 0d5ab8bf..77c61118 100644
--- a/tools/tffarmer/farm.go
+++ b/tools/tffarmer/farm.go
@@ -3,6 +3,7 @@ package main
 import (
 	"fmt"
 
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/directory"
 	"github.com/urfave/cli"
 )
 
@@ -15,7 +16,11 @@ func registerFarm(c *cli.Context) error {
 
 	tid := c.Uint64("tid")
 
-	farmID, err := idStore.RegisterFarm(tid, name, "", []string{"fake"})
+	farmID, err := db.FarmRegister(directory.Farm{
+		Name:            name,
+		ThreebotId:      int64(tid),
+		WalletAddresses: []string{"fake"},
+	})
 	if err != nil {
 		return err
 	}
diff --git a/tools/tffarmer/main.go b/tools/tffarmer/main.go
index b647cfa2..05981c2f 100644
--- a/tools/tffarmer/main.go
+++ b/tools/tffarmer/main.go
@@ -1,20 +1,18 @@
 package main
 
 import (
+	"github.com/pkg/errors"
 	"github.com/rs/zerolog"
 	"github.com/rs/zerolog/log"
 
 	"os"
 
-	"github.com/threefoldtech/zos/pkg/identity"
-	"github.com/threefoldtech/zos/pkg/network"
-	"github.com/threefoldtech/zos/pkg/network/tnodb"
+	"github.com/threefoldtech/zos/tools/client"
 	"github.com/urfave/cli"
 )
 
 var (
-	idStore identity.IDStore
-	db      network.TNoDB
+	db client.Directory
 )
 
 func main() {
@@ -44,8 +42,12 @@ func main() {
 		log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
 
 		url := c.String("bcdb")
-		idStore = identity.NewHTTPIDStore(url)
-		db = tnodb.NewHTTPTNoDB(url)
+		cl, err := client.NewClient(url)
+		if err != nil {
+			return errors.Wrap(err, "failed to create client to bcdb")
+		}
+
+		db = cl.Directory
 
 		return nil
 	}
diff --git a/tools/tffarmer/network.go b/tools/tffarmer/network.go
index b65a44b9..012aff1f 100644
--- a/tools/tffarmer/network.go
+++ b/tools/tffarmer/network.go
@@ -4,8 +4,8 @@ import (
 	"fmt"
 	"net"
 
-	"github.com/threefoldtech/zos/pkg"
-	"github.com/threefoldtech/zos/pkg/network/types"
+	"github.com/threefoldtech/zos/pkg/schema"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/directory"
 
 	"github.com/urfave/cli"
 )
@@ -63,19 +63,19 @@ func configPublic(c *cli.Context) error {
 	}
 
 	node := c.Args().First()
-	pubIface := &types.PubIface{
+	pubIface := directory.PublicIface{
 		Master: iface,
-		GW4:    gw4,
-		GW6:    gw6,
+		Gw4:    gw4,
+		Gw6:    gw6,
 	}
 	if nv4 != nil {
-		pubIface.IPv4 = types.NewIPNet(nv4)
+		pubIface.Ipv4 = schema.IPRange{IPNet: *nv4}
 	}
 	if nv6 != nil {
-		pubIface.IPv6 = types.NewIPNet(nv6)
+		pubIface.Ipv6 = schema.IPRange{IPNet: *nv6}
 	}
 
-	if err := db.SetPublicIface(pkg.StrIdentifier(node), pubIface); err != nil {
+	if err := db.NodeSetPublic(node, pubIface); err != nil {
 		return err
 	}
 	fmt.Printf("public interface configured on node %s\n", node)
diff --git a/tools/tfuser/cmds_identity.go b/tools/tfuser/cmds_identity.go
index 30f3ab6c..61f97fe5 100644
--- a/tools/tfuser/cmds_identity.go
+++ b/tools/tfuser/cmds_identity.go
@@ -6,6 +6,7 @@ import (
 
 	"github.com/pkg/errors"
 	"github.com/threefoldtech/zos/pkg/identity"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/phonebook"
 	"github.com/urfave/cli"
 )
 
@@ -28,7 +29,13 @@ func cmdsGenerateID(c *cli.Context) error {
 		return err
 	}
 
-	id, err := client.CreateUser(name, email, hex.EncodeToString(k.PublicKey), description)
+	user := phonebook.User{
+		Name:        name,
+		Email:       email,
+		Signature:   hex.EncodeToString(k.PublicKey),
+		Description: description,
+	}
+	id, err := bcdb.Phonebook.Create(user)
 	if err != nil {
 		return errors.Wrap(err, "failed to register user")
 	}
diff --git a/tools/tfuser/cmds_live.go b/tools/tfuser/cmds_live.go
index 925ec235..a209c7a2 100644
--- a/tools/tfuser/cmds_live.go
+++ b/tools/tfuser/cmds_live.go
@@ -3,14 +3,15 @@ package main
 import (
 	"encoding/json"
 	"fmt"
-	"net/http"
 	"os"
 	"sync"
 	"time"
 
-	generated "github.com/threefoldtech/zos/pkg/gedis/types/provision"
+	"github.com/rs/zerolog/log"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/workloads"
+	"gopkg.in/yaml.v2"
 
-	"github.com/threefoldtech/zos/pkg/provision"
+	"github.com/threefoldtech/zos/pkg/schema"
 	"github.com/urfave/cli"
 )
 
@@ -42,92 +43,113 @@ func cmdsLive(c *cli.Context) error {
 	return nil
 }
 
+type O map[string]interface{}
+
 const timeLayout = "02-Jan-2006 15:04:05"
 
-func printResult(r generated.TfgridReservation1) {
+func printResult(r workloads.Reservation) {
 	expire := r.DataReservation.ExpirationReservation
-	fmt.Printf("ID:%6d expired at:%20s", r.ID, expire.Format(timeLayout))
-
-	if len(r.Results) <= 0 {
-		fmt.Printf("state: not deployed yet\n")
-		return
-	}
+	output := O{}
+	fmt.Printf("ID: %d Expires: %s\n", r.ID, expire.Format(timeLayout))
 
-	resultPerID := make(map[int64]generated.TfgridReservationResult1, len(r.Results))
+	resultPerID := make(map[int64][]workloads.Result, len(r.Results))
 	for _, r := range r.Results {
 		var (
 			rid int64
 			wid int64
 		)
-		fmt.Sscanf(r.WorkloadID, "%d-%d", &rid, &wid)
-		resultPerID[wid] = r
+		fmt.Sscanf(r.WorkloadId, "%d-%d", &rid, &wid)
+		results := resultPerID[wid]
+		results = append(results, r)
+
+		resultPerID[wid] = results
+	}
+
+	resultData := func(in json.RawMessage) O {
+		var o O
+		if err := json.Unmarshal(in, &o); err != nil {
+			panic("invalid json")
+		}
+		return o
+	}
+
+	allResults := func(in []workloads.Result) []O {
+		var o []O
+		for _, i := range in {
+			r := resultData(i.DataJson)
+			r["node"] = i.NodeId
+			r["state"] = i.State.String()
+			o = append(o, r)
+		}
+		return o
 	}
 
 	for _, n := range r.DataReservation.Networks {
-		fmt.Printf("\tnetwork ID: %s\n", n.Name)
+		d := O{
+			"kind":    "network",
+			"name":    n.Name,
+			"results": allResults(resultPerID[n.WorkloadId]),
+		}
+
+		output[fmt.Sprintf("Workload %d", n.WorkloadId)] = d
 	}
+
 	for _, c := range r.DataReservation.Containers {
-		result := resultPerID[c.WorkloadID]
-		if result.State == generated.TfgridReservationResult1StateError {
-			fmt.Printf("\terror: %s\n", result.Message)
-			continue
+		var ips []string
+		for _, ip := range c.NetworkConnection {
+			ips = append(ips, ip.Ipaddress.String())
 		}
 
-		data := provision.Container{}
-		if err := json.Unmarshal(result.DataJSON, &data); err != nil {
-			panic(err)
-		}
-		fmt.Printf("\tflist: %s", data.FList)
-		for _, ip := range data.Network.IPs {
-			fmt.Printf("\tIP: %s", ip)
+		d := O{
+			"kind":    "container",
+			"flist":   c.Flist,
+			"ip":      ips,
+			"results": allResults(resultPerID[c.WorkloadId]),
 		}
-		fmt.Printf("\n")
+
+		output[fmt.Sprintf("Workload %d", c.WorkloadId)] = d
 	}
+
 	for _, v := range r.DataReservation.Volumes {
-		result := resultPerID[v.WorkloadID]
-		if result.State == generated.TfgridReservationResult1StateError {
-			fmt.Printf("\terror: %s\n", result.Message)
-			continue
+		d := O{
+			"kind":    "volume",
+			"size":    v.Size,
+			"type":    v.Type.String(),
+			"results": allResults(resultPerID[v.WorkloadId]),
 		}
 
-		data := provision.VolumeResult{}
-		if err := json.Unmarshal(result.DataJSON, &data); err != nil {
-			panic(err)
-		}
-		fmt.Printf("\tVolume ID: %s Size: %d Type: %s\n", data.ID, v.Size, v.Type)
+		output[fmt.Sprintf("Workload %d", v.WorkloadId)] = d
+
 	}
+
 	for _, z := range r.DataReservation.Zdbs {
-		result := resultPerID[z.WorkloadID]
-		if result.State == generated.TfgridReservationResult1StateError {
-			fmt.Printf("\terror: %s\n", result.Message)
-			continue
+		d := O{
+			"kind":    "zdb",
+			"size":    z.Size,
+			"mode":    z.Mode.String(),
+			"results": allResults(resultPerID[z.WorkloadId]),
 		}
 
-		data := provision.ZDBResult{}
-		if err := json.Unmarshal(result.DataJSON, &data); err != nil {
-			panic(err)
-		}
-		fmt.Printf("\tAddr %s:%d Namespace %s\n", data.IP, data.Port, data.Namespace)
+		output[fmt.Sprintf("Workload %d", z.WorkloadId)] = d
 	}
+
 	for _, k := range r.DataReservation.Kubernetes {
-		result := resultPerID[k.WorkloadID]
-		if result.State == generated.TfgridReservationResult1StateError {
-			fmt.Printf("\terror: %s\n", result.Message)
-			continue
+		d := O{
+			"kind":    "kubernetes",
+			"size":    k.Size,
+			"network": k.NetworkId,
+			"ip":      k.MasterIps,
+			"results": allResults(resultPerID[k.WorkloadId]),
 		}
 
-		data := provision.Kubernetes{}
-		if err := json.Unmarshal(result.DataJSON, &data); err != nil {
-			panic(err)
-		}
+		output[fmt.Sprintf("Workload %d", k.WorkloadId)] = d
+	}
 
-		fmt.Printf("\tip: %v", data.IP)
-		if data.MasterIPs == nil || len(data.MasterIPs) == 0 {
-			fmt.Print(" master\n")
-		} else {
-			fmt.Printf("\n")
-		}
+	if err := yaml.NewEncoder(os.Stdout).Encode(output); err != nil {
+		log.Error().Err(err).Msg("failed to print result")
 	}
+
+	fmt.Println("-------------------------")
 }
 
 type scraper struct {
@@ -145,11 +167,11 @@ type job struct {
 	deleted bool
 }
 
-func (s *scraper) Scrap(user int64) chan generated.TfgridReservation1 {
+func (s *scraper) Scrap(user int64) chan workloads.Reservation {
 
 	var (
 		cIn  = make(chan job)
-		cOut = make(chan generated.TfgridReservation1)
+		cOut = make(chan workloads.Reservation)
 	)
 
 	s.wg.Add(s.poolSize)
@@ -178,7 +200,7 @@ func (s *scraper) Scrap(user int64) chan generated.TfgridReservation1 {
 	return cOut
 }
 
-func worker(wg *sync.WaitGroup, cIn <-chan job, cOut chan<- generated.TfgridReservation1) {
+func worker(wg *sync.WaitGroup, cIn <-chan job, cOut chan<- workloads.Reservation) {
 	defer func() {
 		wg.Done()
 	}()
@@ -197,7 +219,7 @@ func worker(wg *sync.WaitGroup, cIn <-chan job, cOut chan<- generated.TfgridRese
 			continue
 		}
 		// FIXME: beurk
-		if !job.deleted && len(res.Results) > 0 && res.Results[0].State == generated.TfgridReservationResult1StateDeleted {
+		if !job.deleted && len(res.Results) > 0 && res.Results[0].State == workloads.ResultStateDeleted {
 			continue
 		}
 		if res.CustomerTid != job.user {
@@ -207,26 +229,6 @@ func worker(wg *sync.WaitGroup, cIn <-chan job, cOut chan<- generated.TfgridRese
 	}
 }
 
-func getResult(id int) (res generated.TfgridReservation1, err error) {
-	url := fmt.Sprintf("https://explorer.devnet.grid.tf/reservations/%d", id)
-	resp, err := http.Get(url)
-	if err != nil {
-		return res, err
-	}
-
-	defer resp.Body.Close()
-
-	if resp.StatusCode == http.StatusNotFound {
-		return res, os.ErrNotExist
-	}
-
-	if resp.StatusCode != http.StatusOK {
-		return res, fmt.Errorf("wrong status code %s", resp.Status)
-	}
-
-	if err := json.NewDecoder(resp.Body).Decode(&res); err != nil {
-		return res, err
-	}
-
-	return res, nil
+func getResult(id int) (res workloads.Reservation, err error) {
+	return bcdb.Workloads.Get(schema.ID(id))
 }
diff --git a/tools/tfuser/cmds_network.go b/tools/tfuser/cmds_network.go
index 1d83c3b3..eca98538 100644
--- a/tools/tfuser/cmds_network.go
+++ b/tools/tfuser/cmds_network.go
@@ -352,14 +352,14 @@ func loadNetwork(name string) (*Network, error) {
 }
 
 func pickPort(nodeID string) (uint, error) {
-	node, err := client.GetNode(pkg.StrIdentifier(nodeID))
+	node, err := bcdb.Directory.NodeGet(nodeID, false)
 	if err != nil {
 		return 0, err
 	}
 
 	p := uint(rand.Intn(6000) + 2000)
 
-	for isIn(node.WGPorts, p) {
+	for isIn(node.WgPorts, p) {
 		p = uint(rand.Intn(6000) + 2000)
 	}
 	return p, nil
@@ -369,10 +369,12 @@ func pickPort(nodeID string) (uint, error) {
 // some interface has received a SLAAC addr
 // which has been registered in BCDB
 func getEndPointAddrs(nodeID pkg.Identifier) ([]types.IPNet, error) {
-	node, err := client.GetNode(nodeID)
+
+	schemaNode, err := bcdb.Directory.NodeGet(nodeID.Identity(), false)
 	if err != nil {
 		return nil, err
 	}
+	node := types.NewNodeFromSchema(schemaNode)
 	var endpoints []types.IPNet
 	if node.PublicConfig != nil {
 		if node.PublicConfig.IPv4.IP != nil {
@@ -401,9 +403,9 @@ func getEndPointAddrs(nodeID pkg.Identifier) ([]types.IPNet, error) {
 	return endpoints, nil
 }
 
-func isIn(l []uint, i uint) bool {
+func isIn(l []int64, i uint) bool {
 	for _, x := range l {
-		if i == x {
+		if int64(i) == x {
 			return true
 		}
 	}
diff --git a/tools/tfuser/cmds_provision.go b/tools/tfuser/cmds_provision.go
index cd94194c..fb9656d9 100644
--- a/tools/tfuser/cmds_provision.go
+++ b/tools/tfuser/cmds_provision.go
@@ -1,7 +1,6 @@
 package main
 
 import (
-	"bytes"
 	"encoding/hex"
 	"encoding/json"
 	"fmt"
@@ -13,9 +12,9 @@ import (
 	"github.com/pkg/errors"
 	"github.com/threefoldtech/zos/pkg"
 	"github.com/threefoldtech/zos/pkg/crypto"
-	"github.com/threefoldtech/zos/pkg/gedis"
-	"github.com/threefoldtech/zos/pkg/identity"
 	"github.com/threefoldtech/zos/pkg/provision"
+	"github.com/threefoldtech/zos/pkg/schema"
+	"github.com/threefoldtech/zos/tools/client"
 
 	"github.com/urfave/cli"
 )
@@ -111,7 +110,7 @@ func cmdsProvision(c *cli.Context) error {
 		}
 	}
 
-	keypair, err := identity.LoadKeyPair(seedPath)
+	signer, err := client.NewSignerFromFile(seedPath)
 	if err != nil {
 		return errors.Wrapf(err, "could not find seed file at %s", seedPath)
 	}
@@ -144,7 +143,7 @@ func cmdsProvision(c *cli.Context) error {
 		}
 	}
 
-	jsx, err := gedis.ReservationToSchemaType(&reservation)
+	jsx, err := reservation.ToSchemaType()
 	if err != nil {
 		return errors.Wrap(err, "failed to convert reservation to schema type")
 	}
@@ -158,13 +157,13 @@ func cmdsProvision(c *cli.Context) error {
 		return err
 	}
 
-	jsx.JSON = string(bytes)
-	signature, err := crypto.Sign(keypair.PrivateKey, []byte(jsx.JSON))
+	jsx.Json = string(bytes)
+	_, signature, err := signer.SignHex(jsx.Json)
 	if err != nil {
 		return errors.Wrap(err, "failed to sign the reservation")
 	}
 
-	jsx.CustomerSignature = hex.EncodeToString(signature)
+	jsx.CustomerSignature = signature
 
 	if c.Bool("dry-run") {
 		enc := json.NewEncoder(os.Stdout)
@@ -172,7 +171,7 @@ func cmdsProvision(c *cli.Context) error {
 		return enc.Encode(jsx)
 	}
 
-	id, err := client.ReserveJSX(jsx)
+	id, err := bcdb.Workloads.Create(jsx)
 	if err != nil {
 		return errors.Wrap(err, "failed to send reservation")
 	}
@@ -204,30 +203,22 @@ func cmdsDeleteReservation(c *cli.Context) error {
 		seedPath = c.String("seed")
 	)
 
-	reservation, err := client.GetJSX(resID)
+	reservation, err := bcdb.Workloads.Get(schema.ID(resID))
 	if err != nil {
 		return errors.Wrap(err, "failed to get reservation info")
 	}
 
-	keypair, err := identity.LoadKeyPair(seedPath)
+	signer, err := client.NewSignerFromFile(seedPath)
 	if err != nil {
 		return errors.Wrapf(err, "could not find seed file at %s", seedPath)
 	}
 
-	var buf bytes.Buffer
-	if _, err := buf.WriteString(fmt.Sprint(resID)); err != nil {
-		return err
-	}
-	if _, err := buf.Write([]byte(reservation.JSON)); err != nil {
-		return err
-	}
-
-	signature, err := crypto.Sign(keypair.PrivateKey, buf.Bytes())
+	_, signature, err := signer.SignHex(resID, reservation.Json)
 	if err != nil {
 		return errors.Wrap(err, "failed to sign the reservation")
 	}
 
-	if err := client.Delete(userID, resID, signature); err != nil {
+	if err := bcdb.Workloads.SignDelete(schema.ID(resID), schema.ID(userID), signature); err != nil {
 		return errors.Wrapf(err, "failed to sign deletion of reservation: %d", resID)
 	}
 
diff --git a/tools/tfuser/main.go b/tools/tfuser/main.go
index 4cc494f5..91923fce 100644
--- a/tools/tfuser/main.go
+++ b/tools/tfuser/main.go
@@ -1,29 +1,17 @@
 package main
 
 import (
-	"bytes"
-	"encoding/json"
-	"fmt"
-	"net/http"
-	"net/url"
-
-	"github.com/pkg/errors"
-
-	"github.com/threefoldtech/zos/pkg/provision"
-
 	"github.com/rs/zerolog"
 	"github.com/rs/zerolog/log"
+	"github.com/threefoldtech/zos/tools/client"
 
 	"os"
 
-	types "github.com/threefoldtech/zos/pkg/gedis/types/provision"
-	"github.com/threefoldtech/zos/pkg/network"
-	"github.com/threefoldtech/zos/pkg/network/tnodb"
 	"github.com/urfave/cli"
 )
 
 var (
-	client clientIface
+	bcdb *client.Client
 )
 
 func main() {
@@ -53,7 +41,7 @@ func main() {
 		log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
 
 		var err error
-		client, err = getClient(c.String("bcdb"))
+		bcdb, err = getClient(c.String("bcdb"))
 		if err != nil {
 			return err
 		}
@@ -470,139 +458,6 @@ func main() {
 	}
 }
 
-type reserveDeleter interface {
-	Reserve(r *provision.Reservation) (string, error)
-	Delete(userID, id int64, sig []byte) error
-}
-type clientIface interface {
-	network.TNoDB
-	reserveDeleter
-	CreateUser(name, email, pubkey, description string) (int64, error)
-	ReserveJSX(res types.TfgridReservation1) (int64, error)
-	GetJSX(id int64) (res types.TfgridReservation1, err error)
-}
-
-type clientImpl struct {
-	network.TNoDB
-	reserveDeleter
-	baseURL string
-}
-
-func (p clientImpl) GetJSX(id int64) (res types.TfgridReservation1, err error) {
-	url := fmt.Sprintf("%s/reservations/%d", p.baseURL, id)
-
-	resp, err := http.Get(url)
-	if err != nil {
-		return res, err
-	}
-
-	defer resp.Body.Close()
-
-	if resp.StatusCode != http.StatusOK {
-		return res, fmt.Errorf("wrong response status code %s", resp.Status)
-	}
-
-	if err := json.NewDecoder(resp.Body).Decode(&res); err != nil {
-		return res, err
-	}
-
-	return
-}
-
-func (p clientImpl) ReserveJSX(res types.TfgridReservation1) (int64, error) {
-	var buf bytes.Buffer
-	err := json.NewEncoder(&buf).Encode(res)
-	if err != nil {
-		return 0, err
-	}
-
-	response, err := http.Post(
-		fmt.Sprintf("%s/reservations", p.baseURL),
-		"application/json",
-		&buf,
-	)
-
-	if err != nil {
-		return 0, errors.Wrap(err, "failed to create reservation")
-	}
-
-	defer response.Body.Close()
-
-	if response.StatusCode != http.StatusCreated {
-		return 0, fmt.Errorf("wrong status for reservation create: %s", response.Status)
-	}
-
-	var id int64
-
-	if err := json.NewDecoder(response.Body).Decode(&id); err != nil {
-		return 0, errors.Wrap(err, "failed to load user response")
-	}
-
-	return id, nil
-
-}
-
-func (p clientImpl) CreateUser(name, email, pubkey, description string) (int64, error) {
-	var buf bytes.Buffer
-	type U map[string]interface{}
-	err := json.NewEncoder(&buf).Encode(U{
-		"name":        name,
-		"email":       email,
-		"pubkey":      pubkey,
-		"description": description,
-	})
-	if err != nil {
-		return 0, err
-	}
-
-	response, err := http.Post(
-		fmt.Sprintf("%s/users", p.baseURL),
-		"application/json",
-		&buf,
-	)
-
-	if err != nil {
-		return 0, errors.Wrap(err, "failed to create user")
-	}
-
-	defer response.Body.Close()
-
-	if response.StatusCode != http.StatusCreated {
-		return 0, fmt.Errorf("wrong status for user create: %s", response.Status)
-	}
-
-	var result struct {
-		ID int64 `json:"id"`
-	}
-
-	if err := json.NewDecoder(response.Body).Decode(&result); err != nil {
-		return 0, errors.Wrap(err, "failed to load user response")
-	}
-
-	return result.ID, nil
-}
-
-func getClient(addr string) (clientIface, error) {
-
-	u, err := url.Parse(addr)
-	if err != nil {
-		return nil, err
-	}
-
-	switch u.Scheme {
-	case "http", "https":
-		return clientImpl{
-			TNoDB:          tnodb.NewHTTPTNoDB(addr),
-			reserveDeleter: provision.NewHTTPStore(addr),
-			baseURL:        addr,
-		}, nil
-	// case "tcp":
-	// 	c, err := gedis.New(addr, "")
-	// 	return client{
-	// 		c,
-	// 		c,
-	// 	}, err
-	default:
-		return nil, fmt.Errorf("unsupported address scheme for BCDB: %s", u.Scheme)
-	}
+func getClient(addr string) (*client.Client, error) {
+	return client.NewClient(addr)
 }


Test patch:
diff --git a/pkg/gedis/commands_identity_test.go b/pkg/gedis/commands_identity_test.go
deleted file mode 100644
index c57508ad..00000000
--- a/pkg/gedis/commands_identity_test.go
+++ /dev/null
@@ -1,226 +0,0 @@
-package gedis
-
-import (
-	"encoding/hex"
-	"fmt"
-	"testing"
-
-	"github.com/jbenet/go-base58"
-	"github.com/stretchr/testify/require"
-	"github.com/threefoldtech/zos/pkg"
-	"github.com/threefoldtech/zos/pkg/gedis/types/directory"
-	"github.com/threefoldtech/zos/pkg/geoip"
-)
-
-func TestRegisterFarm(t *testing.T) {
-	require := require.New(t)
-	pool, conn := getTestPool()
-	gedis := Gedis{
-		pool: pool,
-	}
-
-	args := Args{
-		"farm": directory.TfgridFarm1{
-			ThreebotID:      10,
-			Name:            "my-node",
-			Email:           "azmy@test.com",
-			WalletAddresses: []string{"addr1", "addr2"},
-		},
-	}
-
-	conn.On("Do", "tfgrid.directory.farms.register", mustMarshal(t, args)).
-		Return(mustMarshal(t, Args{"farm_id": 123}), nil)
-
-	id, err := gedis.RegisterFarm(
-		10,
-		"my-node",
-		"azmy@test.com",
-		[]string{"addr1", "addr2"},
-	)
-
-	require.NoError(err)
-	require.Equal(id, pkg.FarmID(123))
-	conn.AssertCalled(t, "Close")
-}
-
-func TestRegisterNode(t *testing.T) {
-	require := require.New(t)
-	pool, conn := getTestPool()
-	gedis := Gedis{
-		pool: pool,
-	}
-
-	l, err := geoip.Fetch()
-	require.NoError(err)
-
-	args := Args{
-		"node": directory.TfgridNode2{
-			NodeID:       "node-1",
-			FarmID:       1,
-			OsVersion:    "v1.1.0",
-			PublicKeyHex: hex.EncodeToString(base58.Decode("node-1")),
-			Location: directory.TfgridLocation1{
-				Longitude: l.Longitute,
-				Latitude:  l.Latitude,
-				Continent: l.Continent,
-				Country:   l.Country,
-				City:      l.City,
-			},
-		},
-	}
-
-	conn.On("Do", "tfgrid.directory.nodes.add", mustMarshal(t, args)).
-		Return(mustMarshal(t, Args{"node_id": "node-1"}), nil)
-
-	id, err := gedis.RegisterNode(
-		pkg.StrIdentifier("node-1"),
-		pkg.FarmID(1),
-		"v1.1.0",
-		l,
-	)
-
-	require.NoError(err)
-	require.Equal(id, "node-1")
-	conn.AssertCalled(t, "Close")
-}
-
-func TestListNode(t *testing.T) {
-	require := require.New(t)
-	pool, conn := getTestPool()
-	gedis := Gedis{
-		pool: pool,
-	}
-
-	args := Args{
-		"farm_id": 1,
-		"country": "eg",
-		"city":    "cairo",
-	}
-
-	conn.On("Do", "tfgrid.directory.nodes.list", mustMarshal(t, args)).
-		Return(mustMarshal(t, Args{"nodes": []directory.TfgridNode2{
-			{NodeID: "node-1"},
-			{NodeID: "node-2"},
-		}}), nil)
-
-	nodes, err := gedis.ListNode(
-		pkg.FarmID(1), "eg", "cairo",
-	)
-
-	require.NoError(err)
-	require.Len(nodes, 2)
-	require.Equal(nodes[0].NodeID, "node-1")
-	conn.AssertCalled(t, "Close")
-}
-
-func TestGetNode(t *testing.T) {
-	require := require.New(t)
-	pool, conn := getTestPool()
-	gedis := Gedis{
-		pool: pool,
-	}
-
-	args := Args{
-		"node_id": "node-1",
-	}
-
-	conn.On("Do", "tfgrid.directory.nodes.get", mustMarshal(t, args)).
-		Return(mustMarshal(t, directory.TfgridNode2{
-			NodeID: "node-1",
-		}), nil)
-
-	node, err := gedis.GetNode(
-		pkg.StrIdentifier("node-1"),
-	)
-
-	require.NoError(err)
-	require.Equal(node.NodeID, "node-1")
-	conn.AssertCalled(t, "Close")
-}
-
-func TestGetFarm(t *testing.T) {
-	require := require.New(t)
-	pool, conn := getTestPool()
-	gedis := Gedis{
-		pool: pool,
-	}
-
-	args := Args{
-		"farm_id": 100,
-	}
-
-	conn.On("Do", "tfgrid.directory.farms.get", mustMarshal(t, args)).
-		Return(mustMarshal(t, directory.TfgridFarm1{
-			ID:   100,
-			Name: "farm-1",
-		}), nil)
-
-	farm, err := gedis.GetFarm(
-		pkg.StrIdentifier("100"),
-	)
-
-	require.NoError(err)
-	require.Equal("100", farm.ID)
-	require.Equal("farm-1", farm.Name)
-	conn.AssertCalled(t, "Close")
-}
-
-func TestListFarm(t *testing.T) {
-	require := require.New(t)
-	pool, conn := getTestPool()
-	gedis := Gedis{
-		pool: pool,
-	}
-
-	args := Args{
-		"country": "eg",
-		"city":    "cairo",
-	}
-
-	conn.On("Do", "tfgrid.directory.farms.list", mustMarshal(t, args)).
-		Return(mustMarshal(t, Args{"farms": []directory.TfgridFarm1{
-			{ID: 1, Name: "farm-1"},
-			{ID: 2, Name: "farm-2"},
-		}}), nil)
-
-	nodes, err := gedis.ListFarm("eg", "cairo")
-
-	require.NoError(err)
-	require.Len(nodes, 2)
-	require.Equal(nodes[0].ID, "1")
-	require.Equal(nodes[0].Name, "farm-1")
-	conn.AssertCalled(t, "Close")
-}
-
-func TestUpdateGenericNodeCapacity(t *testing.T) {
-	require := require.New(t)
-	pool, conn := getTestPool()
-	gedis := Gedis{
-		pool: pool,
-	}
-
-	node := pkg.StrIdentifier("node-1")
-
-	args := Args{
-		"node_id": node.Identity(),
-		"resource": directory.TfgridNodeResourceAmount1{
-			Mru: 1,
-			Cru: 2,
-			Hru: 3,
-			Sru: 4,
-		},
-	}
-
-	const captype = "total"
-	action := fmt.Sprintf("tfgrid.directory.nodes.update_%s_capacity", captype)
-	conn.On("Do", action, mustMarshal(t, args)).
-		Return(nil, nil)
-
-	err := gedis.updateGenericNodeCapacity(
-		"total",
-		node,
-		1, 2, 3, 4)
-
-	require.NoError(err)
-	conn.AssertCalled(t, "Close")
-}
diff --git a/pkg/gedis/commands_network_test.go b/pkg/gedis/commands_network_test.go
deleted file mode 100644
index 425828ba..00000000
--- a/pkg/gedis/commands_network_test.go
+++ /dev/null
@@ -1,83 +0,0 @@
-package gedis
-
-import (
-	"net"
-	"testing"
-
-	"github.com/threefoldtech/zos/pkg/schema"
-
-	"github.com/stretchr/testify/require"
-	"github.com/threefoldtech/zos/pkg"
-	"github.com/threefoldtech/zos/pkg/gedis/types/directory"
-	"github.com/threefoldtech/zos/pkg/network/types"
-)
-
-func TestNetworkPublishInterfaces(t *testing.T) {
-	require := require.New(t)
-	pool, conn := getTestPool()
-	gedis := Gedis{
-		pool: pool,
-	}
-
-	id := pkg.StrIdentifier("node-1")
-	r := types.MustParseIPNet("192.168.1.2/24")
-	args := Args{
-		"node_id": id,
-		"ifaces": []directory.TfgridNodeIface1{
-			{
-				Name: "eth0",
-				Addrs: []schema.IPRange{
-					r.ToSchema(),
-				},
-				Gateway: []net.IP{
-					net.ParseIP("192.168.1.1"),
-				},
-			},
-		},
-	}
-
-	conn.On("Do", "tfgrid.directory.nodes.publish_interfaces", mustMarshal(t, args)).
-		Return(nil, nil)
-
-	inf := types.IfaceInfo{
-		Name:    "eth0",
-		Addrs:   []types.IPNet{r},
-		Gateway: []net.IP{net.ParseIP("192.168.1.1")},
-	}
-	err := gedis.PublishInterfaces(id, []types.IfaceInfo{inf})
-
-	require.NoError(err)
-	conn.AssertCalled(t, "Close")
-}
-
-func TestNetworkSetPublicIface(t *testing.T) {
-	require := require.New(t)
-	pool, conn := getTestPool()
-	gedis := Gedis{
-		pool: pool,
-	}
-
-	id := pkg.StrIdentifier("node-1")
-	r := types.MustParseIPNet("192.168.1.2/24")
-	args := Args{
-		"node_id": id,
-		"public": directory.TfgridNodePublicIface1{
-			Master: "eth0",
-			Ipv4:   r.ToSchema(),
-			Gw4:    net.ParseIP("192.168.1.1"),
-		},
-	}
-
-	conn.On("Do", "tfgrid.directory.nodes.set_public_iface", mustMarshal(t, args)).
-		Return(nil, nil)
-
-	err := gedis.SetPublicIface(id, &types.PubIface{
-		Master: "eth0",
-		Type:   types.MacVlanIface,
-		IPv4:   r,
-		GW4:    net.ParseIP("192.168.1.1"),
-	})
-
-	require.NoError(err)
-	conn.AssertCalled(t, "Close")
-}
diff --git a/pkg/gedis/commands_provision_test.go b/pkg/gedis/commands_provision_test.go
deleted file mode 100644
index fe96f77a..00000000
--- a/pkg/gedis/commands_provision_test.go
+++ /dev/null
@@ -1,267 +0,0 @@
-package gedis
-
-import (
-	"encoding/json"
-	"net"
-	"testing"
-	"time"
-
-	"github.com/stretchr/testify/mock"
-
-	"github.com/stretchr/testify/require"
-	"github.com/threefoldtech/zos/pkg"
-	"github.com/threefoldtech/zos/pkg/container/logger"
-	types "github.com/threefoldtech/zos/pkg/gedis/types/provision"
-	"github.com/threefoldtech/zos/pkg/provision"
-	"github.com/threefoldtech/zos/pkg/schema"
-)
-
-func TestProvisionGet(t *testing.T) {
-	require := require.New(t)
-	pool, conn := getTestPool()
-	gedis := Gedis{
-		pool: pool,
-	}
-
-	id := "id"
-
-	args := Args{
-		"gwid": id,
-	}
-
-	workload := `{"workload_id": 10, "type": 0, "size": 100}`
-
-	conn.On("Do", "tfgrid.workloads.workload_manager.workload_get", mustMarshal(t, args)).
-		Return(mustMarshal(t, Args{
-			"workload_id": id,
-			"type":        types.TfgridReservationWorkload1TypeVolume,
-			"content":     json.RawMessage(workload),
-		}), nil)
-
-	res, err := gedis.Get(id)
-
-	require.NoError(err)
-	require.Equal(id, res.ID)
-	EqualJSON(t, mustMarshal(t, Args{"type": "HDD", "size": 100}), res.Data)
-	//require.Equal(node.NodeID, "node-1")
-	conn.AssertCalled(t, "Close")
-}
-
-func TestProvisionPoll(t *testing.T) {
-	require := require.New(t)
-	pool, conn := getTestPool()
-	gedis := Gedis{
-		pool: pool,
-	}
-
-	node := pkg.StrIdentifier("node-1")
-
-	args := Args{
-		"node_id": node.Identity(),
-		"cursor":  0,
-	}
-
-	workloadVol := `{"workload_id": 1, "type": 0, "size": 100}`
-	workloadZdb := `{"workload_id": 1, "mode": 0, "size": 100}`
-
-	conn.On("Do", "tfgrid.workloads.workload_manager.workloads_list", mustMarshal(t, args)).
-		Return(mustMarshal(t, Args{
-			"workloads": []types.TfgridReservationWorkload1{
-				{
-					WorkloadID: "1-1",
-					Type:       types.TfgridReservationWorkload1TypeVolume,
-					Workload:   json.RawMessage(workloadVol),
-				},
-				{
-					WorkloadID: "2-1",
-					Type:       types.TfgridReservationWorkload1TypeZdb,
-					Workload:   json.RawMessage(workloadZdb),
-				},
-			},
-		}), nil)
-
-	reservations, err := gedis.Poll(node, 0) //setting false to true will force epoch to 0
-
-	require.NoError(err)
-	require.Len(reservations, 2)
-	require.Equal(reservations[0].ID, "2-1")
-	require.Equal(reservations[0].Type, provision.ZDBReservation)
-	require.Equal(reservations[1].Type, provision.VolumeReservation)
-	conn.AssertCalled(t, "Close")
-
-	args = Args{
-		"node_id": node.Identity(),
-		"cursor":  10,
-	}
-
-	conn.On("Do", "tfgrid.workloads.workload_manager.workloads_list", mustMarshal(t, args)).
-		Return(mustMarshal(t, Args{
-			"workloads": []types.TfgridReservationWorkload1{
-				{
-					WorkloadID: "1-1",
-					Type:       types.TfgridReservationWorkload1TypeVolume,
-					Workload:   json.RawMessage(workloadVol),
-				},
-				{
-					WorkloadID: "2-1",
-					Type:       types.TfgridReservationWorkload1TypeZdb,
-					Workload:   json.RawMessage(workloadZdb),
-				},
-			},
-		}), nil)
-
-	reservations, err = gedis.Poll(node, 10)
-
-	require.NoError(err)
-	require.Len(reservations, 2)
-	require.Equal(reservations[0].Type, provision.ZDBReservation)
-	require.Equal(reservations[1].Type, provision.VolumeReservation)
-	conn.AssertCalled(t, "Close")
-
-}
-
-func TestProvisionFeedback(t *testing.T) {
-	require := require.New(t)
-	pool, conn := getTestPool()
-	gedis := Gedis{
-		pool: pool,
-	}
-
-	id := "101"
-	result := provision.Result{
-		Type:      provision.ContainerReservation,
-		ID:        id,
-		Created:   time.Now(),
-		State:     provision.StateOk,
-		Data:      json.RawMessage("{}"),
-		Signature: "signature",
-	}
-
-	args := Args{
-		"global_workload_id": "101",
-		"result": types.TfgridReservationResult1{
-			Category:   types.TfgridReservationResult1CategoryContainer,
-			WorkloadID: "101",
-			DataJSON:   result.Data,
-			Signature:  result.Signature,
-			State:      types.TfgridReservationResult1StateOk,
-			Epoch:      schema.Date{Time: result.Created},
-		},
-	}
-
-	conn.On("Do", "tfgrid.workloads.workload_manager.set_workload_result", mustMarshal(t, args)).
-		Return(nil, nil)
-
-	err := gedis.Feedback(id, &result)
-
-	require.NoError(err)
-	conn.AssertCalled(t, "Close")
-}
-
-func TestProvisionReserve(t *testing.T) {
-	require := require.New(t)
-	pool, conn := getTestPool()
-	gedis := Gedis{
-		pool: pool,
-	}
-
-	now := time.Now()
-	reservation := provision.Reservation{
-		NodeID:  "101",
-		Type:    provision.ContainerReservation,
-		ID:      "10",
-		Created: now,
-		Data: json.RawMessage(mustMarshal(t, provision.Container{
-			FList:      "http://hub.grid.tf/test/test.flist",
-			Entrypoint: "/bin/app",
-			Network: provision.Network{
-				NetworkID: "123",
-				IPs:       []net.IP{net.ParseIP("192.168.1.1")},
-			},
-			Logs: []logger.Logs{},
-		})),
-		Duration:  10 * time.Minute,
-		Signature: []byte("signature"),
-	}
-
-	sent := types.TfgridReservation1{
-		Epoch: schema.Date{Time: now},
-		DataReservation: types.TfgridReservationData1{
-			ExpirationReservation:  schema.Date{Time: now.Add(reservation.Duration)},
-			ExpirationProvisioning: schema.Date{Time: now.Add(2 * time.Minute)},
-			Containers: []types.TfgridReservationContainer1{
-				{
-					WorkloadID: 1,
-					NodeID:     "101",
-					Flist:      "http://hub.grid.tf/test/test.flist",
-					Entrypoint: "/bin/app",
-					NetworkConnection: []types.TfgridReservationNetworkConnection1{
-						{NetworkID: "123", Ipaddress: net.ParseIP("192.168.1.1")},
-					},
-					Volumes: []types.TfgridReservationContainerMount1{},
-					Logs:    []types.TfgridReservationLogs1{},
-				},
-			},
-		},
-	}
-
-	args := Args{
-		"reservation": sent,
-	}
-
-	conn.On("Do", "tfgrid.workloads.workload_manager.reservation_register", mock.MatchedBy(func(in []byte) bool {
-		EqualJSON(t, mustMarshal(t, args), in)
-		return true
-	})).
-		Return(mustMarshal(t, Args{
-			"id": 10,
-		}), nil)
-
-	result, err := gedis.Reserve(&reservation)
-
-	require.NoError(err)
-	require.Equal("10", result)
-	conn.AssertCalled(t, "Close")
-}
-
-func TestProvisionDeleted(t *testing.T) {
-	require := require.New(t)
-	pool, conn := getTestPool()
-	gedis := Gedis{
-		pool: pool,
-	}
-
-	id := "101"
-	args := Args{
-		"workload_id": id,
-	}
-
-	conn.On("Do", "tfgrid.workloads.workload_manager.workload_deleted", mustMarshal(t, args)).
-		Return(nil, nil)
-
-	err := gedis.Deleted("", id)
-
-	require.NoError(err)
-	conn.AssertCalled(t, "Close")
-}
-
-func TestProvisionDelete(t *testing.T) {
-	require := require.New(t)
-	pool, conn := getTestPool()
-	gedis := Gedis{
-		pool: pool,
-	}
-
-	id := "101"
-	args := Args{
-		"reservation_id": id,
-	}
-
-	conn.On("Do", "tfgrid.workloads.workload_manager.sign_delete", mustMarshal(t, args)).
-		Return(nil, nil)
-
-	err := gedis.Delete(id)
-
-	require.NoError(err)
-	conn.AssertCalled(t, "Close")
-}
diff --git a/pkg/network/types/types_test.go b/pkg/network/types/types_test.go
index ce482c96..3c272f82 100644
--- a/pkg/network/types/types_test.go
+++ b/pkg/network/types/types_test.go
@@ -6,8 +6,8 @@ import (
 	"testing"
 
 	"github.com/stretchr/testify/assert"
-	"github.com/threefoldtech/zos/pkg/gedis/types/directory"
 	"github.com/threefoldtech/zos/pkg/schema"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/directory"
 )
 
 func TestParseIPNet(t *testing.T) {
@@ -88,7 +88,7 @@ func TestDumpIPNet(t *testing.T) {
 
 func TestNewNodeFromSchema(t *testing.T) {
 	type args struct {
-		node directory.TfgridNode2
+		node directory.Node
 	}
 	tests := []struct {
 		name string
@@ -98,10 +98,10 @@ func TestNewNodeFromSchema(t *testing.T) {
 		{
 			name: "full",
 			args: args{
-				node: directory.TfgridNode2{
-					NodeID: "node_id",
-					FarmID: 1,
-					Ifaces: []directory.TfgridNodeIface1{
+				node: directory.Node{
+					NodeId: "node_id",
+					FarmId: 1,
+					Ifaces: []directory.Iface{
 						{
 							Name: "eth0",
 							Addrs: []schema.IPRange{
@@ -112,15 +112,15 @@ func TestNewNodeFromSchema(t *testing.T) {
 							},
 						},
 					},
-					PublicConfig: &directory.TfgridNodePublicIface1{
+					PublicConfig: &directory.PublicIface{
 						Master: "eth1",
-						Type:   directory.TfgridNodePublicIface1TypeMacvlan,
+						Type:   directory.IfaceTypeMacvlan,
 						Ipv4:   schema.MustParseIPRange("185.69.166.245/24"),
 						Gw4:    net.ParseIP("185.69.166.1"),
 						Ipv6:   schema.MustParseIPRange("2a02:1802:5e:0:1000:0:ff:1/64"),
 						Gw6:    net.ParseIP("2a02:1802:5e::1"),
 					},
-					WGPorts: []uint{1, 2, 3},
+					WgPorts: []int64{1, 2, 3},
 				},
 			},
 			want: &Node{
@@ -156,10 +156,10 @@ func TestNewNodeFromSchema(t *testing.T) {
 		{
 			name: "no-public",
 			args: args{
-				node: directory.TfgridNode2{
-					NodeID: "node_id",
-					FarmID: 1,
-					Ifaces: []directory.TfgridNodeIface1{
+				node: directory.Node{
+					NodeId: "node_id",
+					FarmId: 1,
+					Ifaces: []directory.Iface{
 						{
 							Name: "eth0",
 							Addrs: []schema.IPRange{
@@ -171,7 +171,7 @@ func TestNewNodeFromSchema(t *testing.T) {
 						},
 					},
 					PublicConfig: nil,
-					WGPorts:      []uint{1, 2, 3},
+					WgPorts:      []int64{1, 2, 3},
 				},
 			},
 			want: &Node{
@@ -200,19 +200,19 @@ func TestNewNodeFromSchema(t *testing.T) {
 		{
 			name: "empty-ifaces",
 			args: args{
-				node: directory.TfgridNode2{
-					NodeID: "node_id",
-					FarmID: 1,
-					Ifaces: []directory.TfgridNodeIface1{},
-					PublicConfig: &directory.TfgridNodePublicIface1{
+				node: directory.Node{
+					NodeId: "node_id",
+					FarmId: 1,
+					Ifaces: []directory.Iface{},
+					PublicConfig: &directory.PublicIface{
 						Master: "eth1",
-						Type:   directory.TfgridNodePublicIface1TypeMacvlan,
+						Type:   directory.IfaceTypeVlan,
 						Ipv4:   schema.MustParseIPRange("185.69.166.245/24"),
 						Gw4:    net.ParseIP("185.69.166.1"),
 						Ipv6:   schema.MustParseIPRange("2a02:1802:5e:0:1000:0:ff:1/64"),
 						Gw6:    net.ParseIP("2a02:1802:5e::1"),
 					},
-					WGPorts: []uint{1, 2, 3},
+					WgPorts: []int64{1, 2, 3},
 				},
 			},
 			want: &Node{
diff --git a/pkg/provision/converter_test.go b/pkg/provision/converter_test.go
index 69f7c08a..eeaed84b 100644
--- a/pkg/provision/converter_test.go
+++ b/pkg/provision/converter_test.go
@@ -6,26 +6,26 @@ import (
 	"testing"
 
 	"github.com/threefoldtech/zos/pkg/network/types"
+	"github.com/threefoldtech/zos/tools/bcdb_mock/models/generated/workloads"
 
 	"github.com/threefoldtech/zos/pkg"
 
 	"github.com/stretchr/testify/require"
 	"github.com/threefoldtech/zos/pkg/container/logger"
-	generated "github.com/threefoldtech/zos/pkg/gedis/types/provision"
 	"github.com/threefoldtech/zos/pkg/provision"
 	schema "github.com/threefoldtech/zos/pkg/schema"
 	"gotest.tools/assert"
 )
 
 func TestEnum(t *testing.T) {
-	r := generated.TfgridReservationWorkload1{
-		Type: generated.TfgridReservationWorkload1TypeContainer,
+	r := workloads.ReservationWorkload{
+		Type: workloads.WorkloadTypeContainer,
 	}
 
 	bytes, err := json.Marshal(r)
 	require.NoError(t, err)
 
-	var o generated.TfgridReservationWorkload1
+	var o workloads.ReservationWorkload
 
 	require.NoError(t, json.Unmarshal(bytes, &o))
 
@@ -41,9 +41,9 @@ func TestTfgridReservationContainer1_ToProvisionType(t *testing.T) {
 		Environment       map[string]string
 		Entrypoint        string
 		Interactive       bool
-		Volumes           []generated.TfgridReservationContainerMount1
-		NetworkConnection []generated.TfgridReservationNetworkConnection1
-		StatsAggregator   []generated.TfgridReservationStatsaggregator1
+		Volumes           []workloads.ContainerMount
+		NetworkConnection []workloads.NetworkConnection
+		StatsAggregator   []workloads.StatsAggregator
 	}
 	tests := []struct {
 		name    string
@@ -69,6 +69,7 @@ func TestTfgridReservationContainer1_ToProvisionType(t *testing.T) {
 				FList:        "https://hub.grid.tf/tf-official-apps/ubuntu-bionic-build.flist",
 				FlistStorage: "zdb://hub.grid.tf:9900",
 				Env:          map[string]string{"FOO": "BAR"},
+				SecretEnv:    nil,
 				Entrypoint:   "/sbin/my_init",
 				Interactive:  false,
 				Mounts:       []provision.Mount{},
@@ -87,19 +88,19 @@ func TestTfgridReservationContainer1_ToProvisionType(t *testing.T) {
 				Environment: map[string]string{"FOO": "BAR"},
 				Entrypoint:  "/sbin/my_init",
 				Interactive: false,
-				Volumes: []generated.TfgridReservationContainerMount1{
+				Volumes: []workloads.ContainerMount{
 					{
-						VolumeID:   "volume1",
+						VolumeId:   "volume1",
 						Mountpoint: "/mnt",
 					},
 					{
-						VolumeID:   "volume2",
+						VolumeId:   "volume2",
 						Mountpoint: "/data",
 					},
 				},
-				NetworkConnection: []generated.TfgridReservationNetworkConnection1{
+				NetworkConnection: []workloads.NetworkConnection{
 					{
-						NetworkID: "net1",
+						NetworkId: "net1",
 						Ipaddress: net.ParseIP("10.0.0.1"),
 					},
 				},
@@ -109,6 +110,7 @@ func TestTfgridReservationContainer1_ToProvisionType(t *testing.T) {
 				FList:        "https://hub.grid.tf/tf-official-apps/ubuntu-bionic-build.flist",
 				FlistStorage: "zdb://hub.grid.tf:9900",
 				Env:          map[string]string{"FOO": "BAR"},
+				SecretEnv:    nil,
 				Entrypoint:   "/sbin/my_init",
 				Interactive:  false,
 				Mounts: []provision.Mount{
@@ -130,13 +132,14 @@ func TestTfgridReservationContainer1_ToProvisionType(t *testing.T) {
 			wantErr: false,
 		},
 	}
+
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
-			c := generated.TfgridReservationContainer1{
-				WorkloadID:        tt.fields.WorkloadID,
-				NodeID:            tt.fields.NodeID,
+			c := workloads.Container{
+				WorkloadId:        tt.fields.WorkloadID,
+				NodeId:            tt.fields.NodeID,
 				Flist:             tt.fields.Flist,
-				HubURL:            tt.fields.HubURL,
+				HubUrl:            tt.fields.HubURL,
 				Environment:       tt.fields.Environment,
 				Entrypoint:        tt.fields.Entrypoint,
 				Interactive:       tt.fields.Interactive,
@@ -161,8 +164,8 @@ func TestTfgridReservationVolume1_ToProvisionType(t *testing.T) {
 		NodeID          string
 		ReservationID   int64
 		Size            int64
-		Type            generated.TfgridReservationVolume1TypeEnum
-		StatsAggregator []generated.TfgridReservationStatsaggregator1
+		Type            workloads.VolumeTypeEnum
+		StatsAggregator []workloads.StatsAggregator
 	}
 	tests := []struct {
 		name    string
@@ -176,7 +179,7 @@ func TestTfgridReservationVolume1_ToProvisionType(t *testing.T) {
 				WorkloadID:      1,
 				NodeID:          "node1",
 				Size:            10,
-				Type:            generated.TfgridReservationVolume1TypeHDD,
+				Type:            workloads.VolumeTypeHDD,
 				StatsAggregator: nil,
 			},
 			want: provision.Volume{
@@ -190,7 +193,7 @@ func TestTfgridReservationVolume1_ToProvisionType(t *testing.T) {
 				WorkloadID:      1,
 				NodeID:          "node1",
 				Size:            10,
-				Type:            generated.TfgridReservationVolume1TypeSSD,
+				Type:            workloads.VolumeTypeSSD,
 				StatsAggregator: nil,
 			},
 			want: provision.Volume{
@@ -201,9 +204,9 @@ func TestTfgridReservationVolume1_ToProvisionType(t *testing.T) {
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
-			v := generated.TfgridReservationVolume1{
-				WorkloadID:      tt.fields.WorkloadID,
-				NodeID:          tt.fields.NodeID,
+			v := workloads.Volume{
+				WorkloadId:      tt.fields.WorkloadID,
+				NodeId:          tt.fields.NodeID,
 				Size:            tt.fields.Size,
 				Type:            tt.fields.Type,
 				StatsAggregator: tt.fields.StatsAggregator,
@@ -225,9 +228,9 @@ func TestTfgridReservationZdb1_ToProvisionType(t *testing.T) {
 		NodeID        string
 		ReservationID int64
 		Size          int64
-		Mode          generated.TfgridReservationZdb1ModeEnum
+		Mode          workloads.ZDBModeEnum
 		Password      string
-		DiskType      generated.TfgridReservationZdb1DiskTypeEnum
+		DiskType      workloads.DiskTypeEnum
 		Public        bool
 	}
 	tests := []struct {
@@ -243,9 +246,9 @@ func TestTfgridReservationZdb1_ToProvisionType(t *testing.T) {
 				NodeID:     "node1",
 				// ReservationID:,
 				Size:     10,
-				Mode:     generated.TfgridReservationZdb1ModeSeq,
+				Mode:     workloads.ZDBModeSeq,
 				Password: "supersecret",
-				DiskType: generated.TfgridReservationZdb1DiskTypeHdd,
+				DiskType: workloads.DiskTypeHDD,
 				Public:   true,
 			},
 			want: provision.ZDB{
@@ -264,9 +267,9 @@ func TestTfgridReservationZdb1_ToProvisionType(t *testing.T) {
 				NodeID:     "node1",
 				// ReservationID:,
 				Size:     10,
-				Mode:     generated.TfgridReservationZdb1ModeUser,
+				Mode:     workloads.ZDBModeUser,
 				Password: "supersecret",
-				DiskType: generated.TfgridReservationZdb1DiskTypeHdd,
+				DiskType: workloads.DiskTypeHDD,
 				Public:   true,
 			},
 			want: provision.ZDB{
@@ -285,9 +288,9 @@ func TestTfgridReservationZdb1_ToProvisionType(t *testing.T) {
 				NodeID:     "node1",
 				// ReservationID:,
 				Size:     10,
-				Mode:     generated.TfgridReservationZdb1ModeUser,
+				Mode:     workloads.ZDBModeUser,
 				Password: "supersecret",
-				DiskType: generated.TfgridReservationZdb1DiskTypeSsd,
+				DiskType: workloads.DiskTypeSSD,
 				Public:   true,
 			},
 			want: provision.ZDB{
@@ -302,15 +305,15 @@ func TestTfgridReservationZdb1_ToProvisionType(t *testing.T) {
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
-			z := generated.TfgridReservationZdb1{
-				WorkloadID:    tt.fields.WorkloadID,
-				NodeID:        tt.fields.NodeID,
-				ReservationID: tt.fields.ReservationID,
-				Size:          tt.fields.Size,
-				Mode:          tt.fields.Mode,
-				Password:      tt.fields.Password,
-				DiskType:      tt.fields.DiskType,
-				Public:        tt.fields.Public,
+			z := workloads.ZDB{
+				WorkloadId: tt.fields.WorkloadID,
+				NodeId:     tt.fields.NodeID,
+				//ReservationID: tt.fields.ReservationID,
+				Size:     tt.fields.Size,
+				Mode:     tt.fields.Mode,
+				Password: tt.fields.Password,
+				DiskType: tt.fields.DiskType,
+				Public:   tt.fields.Public,
 			}
 			got, _, err := provision.ZDBToProvisionType(z)
 			if !tt.wantErr {
@@ -328,8 +331,8 @@ func TestTfgridReservationNetwork1_ToProvisionType(t *testing.T) {
 		Name             string
 		WorkloadID       int64
 		Iprange          schema.IPRange
-		StatsAggregator  []generated.TfgridReservationStatsaggregator1
-		NetworkResources []generated.TfgridNetworkNetResource1
+		StatsAggregator  []workloads.StatsAggregator
+		NetworkResources []workloads.NetworkNetResource
 	}
 	tests := []struct {
 		name    string
@@ -355,9 +358,9 @@ func TestTfgridReservationNetwork1_ToProvisionType(t *testing.T) {
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
-			n := generated.TfgridReservationNetwork1{
+			n := workloads.Network{
 				Name:             tt.fields.Name,
-				WorkloadID:       tt.fields.WorkloadID,
+				WorkloadId:       tt.fields.WorkloadID,
 				Iprange:          tt.fields.Iprange,
 				StatsAggregator:  tt.fields.StatsAggregator,
 				NetworkResources: tt.fields.NetworkResources,
@@ -380,7 +383,7 @@ func TestTfgridNetworkNetResource1_ToProvisionType(t *testing.T) {
 		WireguardPrivateKeyEncrypted string
 		WireguardPublicKey           string
 		WireguardListenPort          int64
-		Peers                        []generated.WireguardPeer1
+		Peers                        []workloads.WireguardPeer
 	}
 	tests := []struct {
 		name    string
@@ -409,9 +412,9 @@ func TestTfgridNetworkNetResource1_ToProvisionType(t *testing.T) {
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
-			r := generated.TfgridNetworkNetResource1{
-				NodeID:                       tt.fields.NodeID,
-				IPRange:                      tt.fields.IPRange,
+			r := workloads.NetworkNetResource{
+				NodeId:                       tt.fields.NodeID,
+				Iprange:                      tt.fields.IPRange,
 				WireguardPrivateKeyEncrypted: tt.fields.WireguardPrivateKeyEncrypted,
 				WireguardPublicKey:           tt.fields.WireguardPublicKey,
 				WireguardListenPort:          tt.fields.WireguardListenPort,
@@ -432,7 +435,7 @@ func TestWireguardPeer1_ToProvisionType(t *testing.T) {
 	type fields struct {
 		PublicKey  string
 		Endpoint   string
-		AllowedIPs []string
+		AllowedIPs []schema.IPRange
 	}
 	tests := []struct {
 		name    string
@@ -443,9 +446,12 @@ func TestWireguardPeer1_ToProvisionType(t *testing.T) {
 		{
 			name: "main",
 			fields: fields{
-				PublicKey:  "0t11OkPwUBPe6m6wL6JTVzJHNjjReBJbEcnSZPs+pFo=",
-				Endpoint:   "192.168.1.1",
-				AllowedIPs: []string{"192.168.1.0/24", "172.20.0.0/16"},
+				PublicKey: "0t11OkPwUBPe6m6wL6JTVzJHNjjReBJbEcnSZPs+pFo=",
+				Endpoint:  "192.168.1.1",
+				AllowedIPs: []schema.IPRange{
+					schema.MustParseIPRange("192.168.1.0/24"),
+					schema.MustParseIPRange("172.20.0.0/16"),
+				},
 			},
 			want: pkg.Peer{
 				// Subnet: types.ParseIPNet("")
@@ -463,26 +469,25 @@ func TestWireguardPeer1_ToProvisionType(t *testing.T) {
 			fields: fields{
 				PublicKey:  "0t11OkPwUBPe6m6wL6JTVzJHNjjReBJbEcnSZPs+pFo=",
 				Endpoint:   "192.168.1.1",
-				AllowedIPs: []string{"192.168.1.0"},
+				AllowedIPs: []schema.IPRange{schema.MustParseIPRange("192.168.1.0/24")},
 			},
 			want: pkg.Peer{
 				// Subnet: types.ParseIPNet("")
 				WGPublicKey: "0t11OkPwUBPe6m6wL6JTVzJHNjjReBJbEcnSZPs+pFo=",
 				AllowedIPs: []types.IPNet{
 					types.MustParseIPNet("192.168.1.0/24"),
-					types.MustParseIPNet("172.20.0.0/16"),
 				},
 				Endpoint: "192.168.1.1",
 			},
-			wantErr: true,
+			wantErr: false,
 		},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
-			p := generated.WireguardPeer1{
-				PublicKey:  tt.fields.PublicKey,
-				Endpoint:   tt.fields.Endpoint,
-				AllowedIPs: tt.fields.AllowedIPs,
+			p := workloads.WireguardPeer{
+				PublicKey:      tt.fields.PublicKey,
+				Endpoint:       tt.fields.Endpoint,
+				AllowedIprange: tt.fields.AllowedIPs,
 			}
 			got, err := provision.WireguardToProvisionType(p)
 			if !tt.wantErr {