Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

[MAC manager] Improve API consistency and impose retry limit #170

Closed
wants to merge 59 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
d933b0d
[Microservices] Mac address manager
kimeunju108 Apr 6, 2020
f6316b4
[Microservices] Mac address manager - APIs create, get, delete
kimeunju108 Apr 6, 2020
e4b5604
[Microservices] Mac manager - update pom file and lib files
kimeunju108 Apr 7, 2020
336e499
[Microservies] Macmanager document update
kimeunju108 Apr 8, 2020
969841b
Revert "[Microservies] Macmanager document update"
kimeunju108 Apr 8, 2020
55d9c59
update macmanager design such as api and data structure
kimeunju108 Apr 9, 2020
677cf6e
Add design sketch for new requirements
kimeunju108 Apr 9, 2020
449d6e6
Update mac manager design doc
Apr 9, 2020
5886a77
[Microservices] Mac manager - updated unit test cases
kimeunju108 Apr 10, 2020
feb5a20
[Microservices] Mac manager - updated unit test cases
kimeunju108 Apr 10, 2020
c5dd021
Merge branch 'eunju/macmanager' of https://github.com/kimeunju108/alc…
kimeunju108 Apr 10, 2020
391ba83
Merge from featurewei/alcor master and resolve conflicts on macmanage…
Apr 10, 2020
62957d3
[Microservices] Mac manager - updated pictures and unit test cases
kimeunju108 Apr 11, 2020
935e57f
[Microservices] Mac manager - added mac range and mac address pool
kimeunju108 Apr 13, 2020
4d1f37a
Merge branch 'eunju/macmanager' of https://github.com/kimeunju108/alc…
kimeunju108 Apr 13, 2020
ca953ae
Merge branch 'master' into eunju/macmanager
Apr 14, 2020
00e766c
[Microservices] Mac manager - added macmanager service interface and …
kimeunju108 Apr 14, 2020
3f44896
Merge branch 'eunju/macmanager' of https://github.com/kimeunju108/alc…
kimeunju108 Apr 14, 2020
33466fb
[Microservices] Mac manager - add MAC range APIs and MAC allocation a…
kimeunju108 Apr 14, 2020
a86d141
Merge pull request #1 from kimeunju108/eunju/macmanager
kimeunju108 Apr 14, 2020
6f05522
[Microservices] Macmanager - combined activate/deactivate APIs to upd…
kimeunju108 Apr 15, 2020
0d23506
Fix broken maven CI workflow
Apr 15, 2020
7ca5df6
[Microservices] MAC manager - update a pom file
kimeunju108 Apr 15, 2020
2137d4c
Merge branch 'eunju/macmanager' of https://github.com/kimeunju108/alc…
kimeunju108 Apr 15, 2020
42e4ca5
[Microservices] MAC manager - added concurrent handling and comparing…
kimeunju108 Apr 17, 2020
e30c48c
[Microservices] MAC manager - added two sections: concurrent handling…
kimeunju108 Apr 17, 2020
0b852b2
[Microservices] MAC manager - updated delete API response
kimeunju108 Apr 18, 2020
3c223d9
[Microservices] MAC manager - updated activate/deactivate APIs response
kimeunju108 Apr 18, 2020
6ac310e
[Microservices] MAC manager - updated activate/deactivate APIs response
kimeunju108 Apr 18, 2020
3d3a0f4
[Microservices] MAC manager - tested APIs and matched output formaat …
kimeunju108 Apr 18, 2020
f78c95e
[Microservices] MAC manager - tested APIs and matched I/O data format…
kimeunju108 Apr 18, 2020
e44d501
[Microservices] MAC manager - tested APIs and matched I/O data format…
kimeunju108 Apr 18, 2020
d1fc282
[Microservices] MAC manager - tested and verified the design document…
kimeunju108 Apr 18, 2020
1dc52ed
[Microservices] MAC manager - tested and verified the design document…
kimeunju108 Apr 18, 2020
d0745e7
Merge branch 'eunju/macmanager', remote-tracking branch 'origin'
kimeunju108 Apr 18, 2020
44aef16
Merge remote-tracking branch 'origin' into eunju/macmanager
kimeunju108 Apr 18, 2020
325720f
Merge branch 'master' into eunju/macmanager
kimeunju108 Apr 18, 2020
d23fd98
Merge pull request #2 from kimeunju108/eunju/macmanager
kimeunju108 Apr 18, 2020
a11ec2e
[Microservices] MAC manager - resolved github conflict
kimeunju108 Apr 18, 2020
3b7355d
Merge pull request #3 from kimeunju108/eunju/macmanager
kimeunju108 Apr 18, 2020
2d0b7a9
[Microservices] MAC manager - fixed 2 pictures
kimeunju108 Apr 19, 2020
5d4f0b8
Merge pull request #4 from kimeunju108/eunju/macmanager
kimeunju108 Apr 19, 2020
a94f372
[Microservices] MAC manager - add concurrent mac creation function
kimeunju108 Apr 20, 2020
b81ade7
[Microservices] MAC manager - reviewed and corrected the design document
kimeunju108 Apr 20, 2020
59f8837
Merge pull request #5 from kimeunju108/eunju/macmanager
kimeunju108 Apr 20, 2020
a2c0c5b
[Microservices] MAC manager - synchronized redis transaction methods
kimeunju108 Apr 22, 2020
6471dbc
Merge branch 'master' of https://github.com/futurewei-cloud/alcor int…
kimeunju108 Apr 22, 2020
9a3217a
Merge pull request #6 from kimeunju108/eunju/macmanager
kimeunju108 Apr 22, 2020
3addc2e
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
kimeunju108 Apr 22, 2020
485ff9e
Merge pull request #7 from kimeunju108/eunju/macmanager
kimeunju108 Apr 22, 2020
d647d13
[Microservices] Node manager - add controller, service, dao, entity, …
kimeunju108 Apr 27, 2020
2200f24
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
kimeunju108 Apr 27, 2020
27f8d72
Merge branch 'master' into eunju/nodemanager
kimeunju108 Apr 27, 2020
a88e4fa
Merge pull request #8 from kimeunju108/eunju/nodemanager
kimeunju108 Apr 27, 2020
ec24cf4
Microservices] Node Manager - implemented UT and tested APIs.
kimeunju108 Apr 28, 2020
60334f2
Merge branch 'eunju/nodemanager' of https://github.com/kimeunju108/al…
kimeunju108 Apr 28, 2020
7aef537
Merge pull request #9 from kimeunju108/eunju/nodemanager
kimeunju108 Apr 28, 2020
4fbcbaf
[Microservices Node Manager - Add exception handlings
kimeunju108 Apr 29, 2020
a07e2fd
Merge pull request #10 from kimeunju108/eunju/nodemanager
kimeunju108 Apr 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.futurewei.alcor.macmanager.controller;

import com.futurewei.alcor.common.entity.ResponseId;
import com.futurewei.alcor.common.exception.ParameterNullOrEmptyException;
import com.futurewei.alcor.common.exception.ResourcePersistenceException;
import com.futurewei.alcor.macmanager.entity.MacRange;
Expand Down Expand Up @@ -202,14 +203,14 @@ public MacRangeJson updateMacRange(@PathVariable String rangeid, @RequestBody Ma
@RequestMapping(
method = DELETE,
value = {"/macs/ranges/{rangeid}", "/v4/macs/ranges/{rangeid}"})
public String deleteMacRange(@PathVariable String rangeid) throws Exception {
public ResponseId deleteMacRange(@PathVariable String rangeid) throws Exception {
String rangeId = null;
try {
RestPreconditionsUtil.verifyParameterNotNullorEmpty(rangeid);
rangeId = service.deleteMacRange(rangeid);
} catch (ParameterNullOrEmptyException e) {
throw new Exception(e);
}
return "{mac_range: " + rangeId + "}";
return new ResponseId(rangeId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,36 +46,36 @@ private void init() {
}

@Override
public String findItem(String value) {
public synchronized String findItem(String value) {
if (setOperations.isMember(KEY, value))
return value;
else
return null;
}

@Override
public Map findAllItems() {
public synchronized Map findAllItems() {
return (Map) setOperations.members(KEY);
}

@Override
public void addItem(String newItem) {
public synchronized void addItem(String newItem) {
Logger logger = LoggerFactory.getLogger();
logger.log(Level.INFO, newItem);
if (setOperations.isMember(KEY, newItem) == false)
setOperations.add(KEY, newItem);
}

@Override
public void deleteItem(String value) {
public synchronized void deleteItem(String value) {
setOperations.remove(KEY, value);
}

public String getItem() {
public synchronized String getItem() {
return (String) setOperations.randomMember(KEY);
}

public long getSize() {
public synchronized long getSize() {
return setOperations.size(KEY);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,29 @@ private void init() {
}

@Override
public MacRange findItem(String id) {
public synchronized MacRange findItem(String id) {

return (MacRange) hashOperations.get(KEY, id);
}

@Override
public Map<String, MacRange> findAllItems() {
System.out.print("test" + KEY);
public synchronized Map<String, MacRange> findAllItems() {
return hashOperations.entries(KEY);
}

@Override
public void addItem(MacRange newItem) {
public synchronized void addItem(MacRange newItem) {
Logger logger = LoggerFactory.getLogger();
logger.log(Level.INFO, "mac address:" + newItem.getRangeId());
hashOperations.putIfAbsent(KEY, newItem.getRangeId(), newItem);
}

@Override
public void deleteItem(String id) {
public synchronized void deleteItem(String id) {
hashOperations.delete(KEY, id);
}

public void updateItem(MacRange newItem) {
public synchronized void updateItem(MacRange newItem) {
hashOperations.put(KEY, newItem.getRangeId(), newItem);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,43 +49,34 @@ private void init() {
}

@Override
public MacState findItem(String id) {
public synchronized MacState findItem(String id) {

return (MacState) hashOperations.get(KEY, id);
}

@Override
public Map findAllItems() {
public synchronized Map findAllItems() {
return hashOperations.entries(KEY);
}

@Override
public void addItem(MacState newItem) {
public synchronized void addItem(MacState newItem) {
Logger logger = LoggerFactory.getLogger();
logger.log(Level.INFO, "mac address:" + newItem.getMacAddress());
hashOperations.putIfAbsent(KEY, newItem.getMacAddress(), newItem);
}

@Override
public void deleteItem(String id) {
public synchronized void deleteItem(String id) {
hashOperations.delete(KEY, id);
}

public void updateItem(MacState newItem) {
public synchronized void updateItem(MacState newItem) {
hashOperations.put(KEY, newItem.getMacAddress(), newItem);
}

public MacState findMac(String id) {
public synchronized MacState findMac(String id) {
return (MacState) hashOperations.get(KEY, id);
}

public void setKey(String key) {
KEY = key;
}

public boolean exisingOui(String oui) {

return redisTemplate.hasKey(oui);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*Copyright 2019 The Alcor Authors.

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 com.futurewei.alcor.macmanager.exception;

public class InvalidMacRangeException extends Exception {
public InvalidMacRangeException() {
}

public InvalidMacRangeException(String message) {
super(message);
}

public InvalidMacRangeException(String message, Throwable cause) {
super(message, cause);
}

public InvalidMacRangeException(Throwable cause) {
super(cause);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*Copyright 2019 The Alcor Authors.

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 com.futurewei.alcor.macmanager.exception;

public class RetryLimitExceedException extends Exception {
public RetryLimitExceedException() {
}

public RetryLimitExceedException(String message) {
super(message);
}

public RetryLimitExceedException(String message, Throwable cause) {
super(message, cause);
}

public RetryLimitExceedException(Throwable cause) {
super(cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package com.futurewei.alcor.macmanager.exception;

public class UniquenessViolationException extends Exception {
private static final long serialVersionUID = 1L;

public UniquenessViolationException() {
}

Expand Down
Loading