Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor LocalContrailEndpointRepository.
Changes towards pureness of core/driver. A thin wrapper around HNS is introduced. This makes it easier to subsitute a fake implementation in future core/driver tests (in driver_test.go). Change-Id: Id7531eeb238808439121517ec488acca322e8732 Partial-Bug: #1778671
- Loading branch information
Michal Kostrzewa
committed
Jun 28, 2018
1 parent
be77379
commit ecbfc5b
Showing
8 changed files
with
107 additions
and
27 deletions.
There are no files selected for viewing
File renamed without changes.
34 changes: 34 additions & 0 deletions
34
adapters/secondary/local_networking/hns/endpoint_repository.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// Copyright (c) 2018 Juniper Networks, Inc. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// 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 hns | ||
|
||
import ( | ||
"github.com/Microsoft/hcsshim" | ||
) | ||
|
||
type HNSEndpointRepository struct{} | ||
|
||
func (repo *HNSEndpointRepository) CreateEndpoint(configuration *hcsshim.HNSEndpoint) (string, error) { | ||
return CreateHNSEndpoint(configuration) | ||
} | ||
|
||
func (repo *HNSEndpointRepository) GetEndpointByName(name string) (*hcsshim.HNSEndpoint, error) { | ||
return GetHNSEndpointByName(name) | ||
} | ||
|
||
func (repo *HNSEndpointRepository) DeleteEndpoint(endpointID string) error { | ||
return DeleteHNSEndpoint(endpointID) | ||
} |
File renamed without changes.
36 changes: 36 additions & 0 deletions
36
adapters/secondary/local_networking/simulator/endpoint_repository.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// Copyright (c) 2018 Juniper Networks, Inc. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// 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 simulator | ||
|
||
import ( | ||
"errors" | ||
|
||
"github.com/Microsoft/hcsshim" | ||
) | ||
|
||
type InMemEndpointRepository struct{} | ||
|
||
func (repo *InMemEndpointRepository) CreateEndpoint(configuration *hcsshim.HNSEndpoint) (string, error) { | ||
return "", errors.New("Not implemented yet") | ||
} | ||
|
||
func (repo *InMemEndpointRepository) GetEndpointByName(name string) (*hcsshim.HNSEndpoint, error) { | ||
return nil, errors.New("Not implemented yet") | ||
} | ||
|
||
func (repo *InMemEndpointRepository) DeleteEndpoint(endpointID string) error { | ||
return errors.New("Not implemented yet") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters