diff --git a/apstra/two_stage_l3_clos_connectivity_template.go b/apstra/two_stage_l3_clos_connectivity_template.go index cdbd6ff7..3ace9d93 100644 --- a/apstra/two_stage_l3_clos_connectivity_template.go +++ b/apstra/two_stage_l3_clos_connectivity_template.go @@ -7,7 +7,6 @@ import ( "fmt" "net/http" "net/url" - "os" ) const ( @@ -666,56 +665,3 @@ func (o *TwoStageL3ClosClient) GetAllConnectivityTemplateStates(ctx context.Cont return result, nil } - -func GetAllConnectivityTemplatesFromFile(file string) ([]ConnectivityTemplate, error) { - b, err := os.ReadFile(file) - if err != nil { - return nil, err - } - - var raw rawConnectivityTemplate - err = json.Unmarshal(b, &raw) - if err != nil { - return nil, err - } - - ids := raw.rootBatchIds() - result := make([]ConnectivityTemplate, len(ids)) - for i, id := range ids { - polished, err := raw.polish(id) - if err != nil { - return nil, err - } - result[i] = *polished - } - - return result, nil -} - -func GetAllConnectivityTemplateStatesFromFile(file string) ([]ConnectivityTemplateState, error) { - b, err := os.ReadFile(file) - if err != nil { - return nil, err - } - - var response struct { - EndpointPolicies []rawConnectivityTemplateState `json:"endpoint_policies"` - } - err = json.Unmarshal(b, &response) - if err != nil { - return nil, err - } - - result := make([]ConnectivityTemplateState, 0, len(response.EndpointPolicies)/3) - for _, rawPolicy := range response.EndpointPolicies { - if rawPolicy.Visible { - polished, err := rawPolicy.polish() - if err != nil { - return nil, err - } - result = append(result, *polished) - } - } - - return result, nil -} diff --git a/apstra/two_stage_l3_clos_connectivity_template_unit_test.go b/apstra/two_stage_l3_clos_connectivity_template_unit_test.go index 62dd10b0..50bb877e 100644 --- a/apstra/two_stage_l3_clos_connectivity_template_unit_test.go +++ b/apstra/two_stage_l3_clos_connectivity_template_unit_test.go @@ -2,7 +2,6 @@ package apstra import ( "encoding/json" - "log" "testing" ) @@ -240,30 +239,3 @@ func TestBgpOverL3Connectivity(t *testing.T) { t.Fatalf("expected:\n %s\n\n got:\n%s", expectedUserData, *resultUserData) } } - -func TestGetAllConnectivityTemplatesFromFile(t *testing.T) { - file := "/Users/cmarget/20230717-090911/42a2f25d-ba82-423c-9bf2-c715c7ce9748/obj-policy-export" - cts, err := GetAllConnectivityTemplatesFromFile(file) - if err != nil { - t.Fatal(err) - } - - for i, ct := range cts { - if ct.Id == nil { - t.Fatalf("CT at index %d has nil ID", i) - } - log.Println(ct.Id) - } -} - -func TestGetAllConnectivityTemplateStatesFromFile(t *testing.T) { - file := "/Users/cmarget/20230717-090911/42a2f25d-ba82-423c-9bf2-c715c7ce9748/endpoint-policies" - ctStates, err := GetAllConnectivityTemplateStatesFromFile(file) - if err != nil { - t.Fatal(err) - } - - for _, ctState := range ctStates { - log.Println(ctState.Id) - } -}