You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: network_handlers_test.go
    path of file: ./repos/magma/orc8r/cloud/go/services/orchestrator/obsidian/handlers
    
    the code of the file until where you have to start completion: /*
 * Copyright 2020 The Magma Authors.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package handlers_test

import (
	"context"
	"fmt"
	"testing"

	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/labstack/echo/v4"
	"github.com/stretchr/testify/assert"

	models1 "magma/orc8r/cloud/go/models"
	"magma/orc8r/cloud/go/orc8r"
	"magma/orc8r/cloud/go/serdes"
	"magma/orc8r/cloud/go/services/configurator"
	"magma/orc8r/cloud/go/services/configurator/test_init"
	"magma/orc8r/cloud/go/services/obsidian"
	"magma/orc8r/cloud/go/services/obsidian/tests"
	"magma/orc8r/cloud/go/services/orchestrator/obsidian/handlers"
	"magma/orc8r/cloud/go/services/orchestrator/obsidian/models"
)

func Test_GetNetworkHandlers(t *testing.T) {
	test_init.StartTestService(t)

	e := echo.New()
	testURLRoot := "/magma/v1/networks"

	obsidianHandlers := handlers.GetObsidianHandlers()
	listNetwork := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/networks", obsidian.GET).HandlerFunc
	getNetwork := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/networks/:network_id", obsidian.GET).HandlerFunc
	getNetworkState := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/networks/:network_id/state", obsidian.GET).HandlerFunc

	// Test empty case
	tc := tests.Test{
		Method:         "GET",
		URL:            testURLRoot,
		Payload:        nil,
		Handler:        listNetwork,
		ExpectedStatus: 200,
		ExpectedResult: tests.JSONMarshaler([]string{}),
	}
	tests.RunUnitTest(t, e, tc)

	// Test 404
	tc = tests.Test{
		Method:         "GET",
		URL:            fmt.Sprintf("%s/%s/", testURLRoot, "no_such_network"),
		Payload:        nil,
		ParamNames:     []string{"network_id"},
		ParamValues:    []string{"no_such_network"},
		Handler:        getNetwork,
		ExpectedStatus: 404,
		ExpectedError:  "Not Found",
	}
	tests.RunUnitTest(t, e, tc)

	// register a network
	networkName1 := "network1"
	network1 := configurator.Network{
		ID:   "n1",
		Name: networkName1,
	}
	err := configurator.CreateNetwork(context.Background(), network1, serdes.Network)
	assert.NoError(t, err)

	tc = tests.Test{
		Method:  "GET",
		URL:     testURLRoot,
		Payload: nil,

		Handler:        listNetwork,
		ExpectedStatus: 200,
		ExpectedResult: tests.JSONMarshaler([]string{"n1"}),
	}
	tests.RunUnitTest(t, e, tc)

	expectedNetwork1 := models.Network{
		ID:   models1.NetworkID("n1"),
		Name: models1.NetworkName(networkName1),
	}

	tc = tests.Test{
		Method:         "GET",
		URL:            fmt.Sprintf("%s/%s/", testURLRoot, "n1"),
		Payload:        nil,
		ParamNames:     []string{"network_id"},
		ParamValues:    []string{"n1"},
		Handler:        getNetwork,
		ExpectedStatus: 200,
		ExpectedResult: tests.JSONMarshaler(expectedNetwork1),
		ExpectedError:  "",
	}
	tests.RunUnitTest(t, e, tc)

	// add network features
	networkFeatures1 := models.NewDefaultFeaturesConfig()
	update1 := configurator.NetworkUpdateCriteria{
		ID:                   "n1",
		ConfigsToAddOrUpdate: map[string]interface{}{orc8r.NetworkFeaturesConfig: networkFeatures1},
	}
	err = configurator.UpdateNetworks(context.Background(), []configurator.NetworkUpdateCriteria{update1}, serdes.Network)
	assert.NoError(t, err)

	expectedNetwork1 = models.Network{
		ID:       models1.NetworkID("n1"),
		Name:     models1.NetworkName(networkName1),
		Features: networkFeatures1,
	}

	tc = tests.Test{
		Method:
    
func Test_PostNetworkHandlers(t *testing.T) {
	test_init.StartTestService(t)

	e := echo.New()
	testURLRoot := "/magma/v1/networks"

	obsidianHandlers := handlers.GetObsidianHandlers()
	createNetwork := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/networks", obsidian.POST).HandlerFunc
	listNetwork := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/networks", obsidian.GET).HandlerFunc
	getNetwork := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/networks/:network_id", obsidian.GET).HandlerFunc

	// test empty name, description
	network1 := models.NewDefaultNetwork("n1", "", "")
	tc := tests.Test{
		Method:         "POST",
		URL:            testURLRoot,
		Payload:        tests.JSONMarshaler(network1),
		Handler:        createNetwork,
		ExpectedStatus: 400,
		ExpectedError: "validation failure list:\n" +
			"description in body is required\n" +
			"name in body is required",
	}
	tests.RunUnitTest(t, e, tc)

	// test bad networkID format
	network1 = models.NewDefaultNetwork("Network*1", "name", "desc")
	tc = tests.Test{
		Method:         "POST",
		URL:            testURLRoot,
		Payload:        tests.JSONMarshaler(network1),
		Handler:        createNetwork,
		ExpectedStatus: 400,
		ExpectedError: "validation failure list:\n" +
			"id in body should match '^[\\da-z_-]+$'",
	}
	tests.RunUnitTest(t, e, tc)

	// test no DNSConfig
	network1 = models.NewDefaultNetwork("n1", "name", "desc")
	network1.DNS = nil
	tc = tests.Test{
		Method:         "POST",
		URL:            testURLRoot,
		Payload:        tests.JSONMarshaler(network1),
		Handler:        createNetwork,
		ExpectedStatus: 400,
		ExpectedError:  "validation failure list:\ndns in body is required",
	}
	tests.RunUnitTest(t, e, tc)

	// test bad DNSConfig - domain
	network1 = models.NewDefaultNetwork("n1", "name", "desc")
	network1.DNS.Records[0].Domain = ""
	tc = tests.Test{
		Method:         "POST",
		URL:            testURLRoot,
		Payload:        tests.JSONMarshaler(network1),
		Handler:        createNetwork,
		ExpectedStatus: 400,
		ExpectedError: "validation failure list:\n" +
			"validation failure list:\n" +
			"validation failure list:\n" +
			"dns.records.0.domain in body is required",
	}
	tests.RunUnitTest(t, e, tc)

	// test bad DNSConfig - ARecord
	network1 = models.NewDefaultNetwork("n1", "name", "desc")
	network1.DNS.Records[0].ARecord[0] = "not ipv4"
	tc = tests.Test{
		Method:         "POST",
		URL:            testURLRoot,
		Payload:        tests.JSONMarshaler(network1),
		Handler:        createNetwork,
		ExpectedStatus: 400,
		ExpectedError: "validation failure list:\n" +
			"validation failure list:\n" +
			"validation failure list:\n" +
			"dns.records.0.a_record.0 in body must be of type ipv4: \"not ipv4\"",
	}
	tests.RunUnitTest(t, e, tc)

	// test bad DNSConfig - AaaaRecord
	network1 = models.NewDefaultNetwork("n1", "name", "desc")
	network1.DNS.Records[0].AaaaRecord[0] = "not ipv6"
	tc = tests.Test{
		Method:         "POST",
		URL:            testURLRoot,
		Payload:        tests.JSONMarshaler(network1),
		Handler:        createNetwork,
		ExpectedStatus: 400,
		ExpectedError: "validation failure list:\n" +
			"validation failure list:\n" +
			"validation failure list:\n" +
			"dns.records.0.aaaa_record.0 in body must be of type ipv6: \"not ipv6\"",
	}
	tests.RunUnitTest(t, e, tc)

	// happy case
	network1 = models.NewDefaultNetwork("n1", "name", "desc")
	tc = tests.Test{
		Method:         "POST",
		URL:            testURLRoot,
		Payload:        tests.JSONMarshaler(network1),
		Handler:        createNetwork,
		ExpectedStatus: 201,
		ExpectedResult: tests.JSONMarshaler("n1"),
	}
	tests.RunUnitTest(t, e, tc)

	actualNetwork1, err := configurator.LoadNetwork(context.Background(), "n1", true, true, serdes.Network)
	assert.NoError(t, err)
	expectedNetwork1 := configurator.Network{
		ID:          string(network1.ID),
		Type:        string(network1.Type),
		Name:        string(network1.Name),
		Description: string(network1.Description),
		Configs: map[string]interface{}{
			orc8r.DnsdNetworkType:       models.NewDefaultDNSConfig(),
			orc8r.NetworkFeaturesConfig: models.NewDefaultFeaturesConfig(),
			orc8r.NetworkSentryConfig:   models.NewDefaultSentryConfig(),
			orc8r.StateConfig:           models.NewDefaultStateConfig(),
		},
	}
	assert.Equal(t, expectedNetwork1, actualNetwork1)

	tc = tests.Test{
		Method:         "GET",
		URL:            fmt.Sprintf("%s/%s/", testURLRoot, "n1"),
		Payload:        nil,
		ParamNames:     []string{"network_id"},
		ParamValues:    []string{"n1"},
		Handler:        getNetwork,
		ExpectedStatus: 200,
		ExpectedResult: tests.JSONMarshaler(network1),
		ExpectedError:  "",
	}
	tests.RunUnitTest(t, e, tc)

	tc = tests.Test{
		Method:         "GET",
		URL:            testURLRoot,
		Payload:        nil,
		Handler:        listNetwork,
		ExpectedStatus: 200,
		ExpectedResult: tests.JSONMarshaler([]string{"n1"}),
	}
	tests.RunUnitTest(t, e, tc)
}