Skip to content
This repository was archived by the owner on Mar 31, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9645772
Documentation update
pkommoju May 12, 2021
183c36a
Apply changes suggested in review
pkommoju May 22, 2021
4896515
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju May 26, 2021
f170e1e
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju May 28, 2021
bcbf7b1
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju May 29, 2021
efc5b6e
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Jun 1, 2021
c785697
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Jun 8, 2021
d213c03
Merge branch 'master' of https://github.com/pkommoju/alcor
Jun 8, 2021
0f56454
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Jun 8, 2021
4a2a382
Merge branch 'master' of https://github.com/pkommoju/alcor
pkommoju Jun 9, 2021
7f93fe3
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Jun 10, 2021
8d6dd0e
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Jun 15, 2021
b19d428
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
kevin-zhonghao Jun 16, 2021
539d0c0
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Jun 22, 2021
6a9a1c6
Merge branch 'master' of https://github.com/pkommoju/alcor
pkommoju Jun 22, 2021
19430b2
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Jul 1, 2021
1d7ef7e
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Jul 2, 2021
cd1fec6
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Jul 6, 2021
e57abe4
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Jul 20, 2021
1b63054
Add missing file
pkommoju Jul 21, 2021
fe81008
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Jul 21, 2021
118dd53
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Jul 23, 2021
7d9a2e5
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Aug 2, 2021
3884a44
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Aug 4, 2021
0b5cd11
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Aug 6, 2021
3f094be
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Aug 23, 2021
bb777ec
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Sep 10, 2021
c0e8c2d
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Sep 24, 2021
206abc7
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Oct 8, 2021
fab8a00
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Oct 22, 2021
69268a3
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Oct 29, 2021
335b9b8
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Nov 5, 2021
6a95d98
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Nov 29, 2021
08ff9d1
Make REST endpoint and gRPC channel co-exist in NCM
pkommoju Nov 29, 2021
a8fce0e
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Nov 29, 2021
eee257e
Make REST endpoint and gRPC channel co-exist in NCM
pkommoju Nov 29, 2021
61647b9
Enable both REST and gRPC in NCM
pkommoju Nov 30, 2021
937e680
Fix NMM to NCM gRPC problem so that NCM can operate on both gRPC and …
pkommoju Dec 1, 2021
85c8de6
Merge branch 'master' into ncmgrpcrest2
pkommoju Dec 2, 2021
884412b
Merge branch 'master' of https://github.com/futurewei-cloud/alcor
pkommoju Dec 2, 2021
56528ad
Resolve merge conflict
pkommoju Dec 2, 2021
8c93eb4
Fake commit to force push
pkommoju Dec 2, 2021
97da53e
Merge branch 'ncmgrpcrest2' of https://github.com/pkommoju/alcor into…
pkommoju Dec 2, 2021
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 @@ -17,6 +17,7 @@ free of charge, to any person obtaining a copy of this software and associated d

import com.futurewei.alcor.common.tracer.TracerConfiguration;
import com.futurewei.alcor.netwconfigmanager.server.NetworkConfigServer;
import com.futurewei.alcor.netwconfigmanager.server.grpc.GoalStateProvisionerServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand All @@ -27,7 +28,6 @@ free of charge, to any person obtaining a copy of this software and associated d
import javax.annotation.PostConstruct;

@SpringBootApplication
@ComponentScan(value = "com.futurewei.alcor.netwconfigmanager.server")
@EnableAsync
@Import(TracerConfiguration.class)
public class NetworkConfigManagerApplication {
Expand All @@ -37,13 +37,15 @@ public class NetworkConfigManagerApplication {

@PostConstruct
public void instantiateGrpcServer(){
try {
networkConfigServer.start();
networkConfigServer.blockUntilShutdown();
} catch (Exception e) {
e.printStackTrace();
}

Thread server = new Thread(() -> {
try {
networkConfigServer.start();
networkConfigServer.blockUntilShutdown();
} catch (Exception e) {
e.printStackTrace();
}
});
server.start();
}

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ free of charge, to any person obtaining a copy of this software and associated d
import com.futurewei.alcor.netwconfigmanager.entity.HostGoalState;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ free of charge, to any person obtaining a copy of this software and associated d
import io.grpc.ManagedChannelBuilder;
import io.grpc.stub.StreamObserver;
import io.netty.util.concurrent.DefaultThreadFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.concurrent.*;
Expand All @@ -48,33 +50,34 @@ public class GoalStateClientImpl implements GoalStateClient {
private final ExecutorService executor;

// each host_ip should have this amount of gRPC channels
@Value("${grpc.number-of-channels-per-host:1}")
private int numberOfGrpcChannelPerHost;

// when a channel is set up, send this amount of default GoalStates for warmup.
@Value("${grpc.number-of-warmups-per-channel:1}")
private int numberOfWarmupsPerChannel;

// prints out UUID and time, when sending a GoalState to any of the monitorHosts
private ArrayList<String> monitorHosts;

private ConcurrentHashMap<String, ArrayList<GrpcChannelStub>> hostIpGrpcChannelStubMap;


public static GoalStateClientImpl getInstance(int numberOfGrpcChannelPerHost, int numberOfWarmupsPerChannel, ArrayList<String> monitorHosts) {
if (instance == null) {
instance = new GoalStateClientImpl(numberOfGrpcChannelPerHost, numberOfWarmupsPerChannel, monitorHosts);
}
return instance;
}

public GoalStateClientImpl(int numberOfGrpcChannelPerHost, int numberOfWarmupsPerChannel, ArrayList<String> monitorHosts) {
// each host should have at least 1 gRPC channel
if(numberOfGrpcChannelPerHost < 1) {
numberOfGrpcChannelPerHost = 1;
}

// allow users to not send warmups, if they wish to.
if(numberOfWarmupsPerChannel < 0){
numberOfWarmupsPerChannel = 0;
public GoalStateClientImpl(@Value("${grpc.number-of-channels-per-host:1}") int numberOfGrpcChannelPerHost, @Value("${grpc.number-of-warmups-per-channel:1}") int numberOfWarmupsPerChannel, @Value("")ArrayList<String> monitorHosts) {

if ((this.numberOfGrpcChannelPerHost = numberOfGrpcChannelPerHost) < 1) {
this.numberOfGrpcChannelPerHost = 1;
}

if ((this.numberOfWarmupsPerChannel = numberOfWarmupsPerChannel) < 0) {
this.numberOfWarmupsPerChannel = 0;
}

this.monitorHosts = monitorHosts;
Expand All @@ -83,8 +86,6 @@ public GoalStateClientImpl(int numberOfGrpcChannelPerHost, int numberOfWarmupsPe
logger.log(Level.FINE, "Monitoring this host: "+ host);
}
logger.log(Level.FINE, "Done printing out all monitorHosts");
this.numberOfGrpcChannelPerHost = numberOfGrpcChannelPerHost;
this.numberOfWarmupsPerChannel = numberOfWarmupsPerChannel;
this.hostAgentPort = 50001;

this.executor = new ThreadPoolExecutor(100,
Expand All @@ -96,6 +97,7 @@ public GoalStateClientImpl(int numberOfGrpcChannelPerHost, int numberOfWarmupsPe
//TODO: Setup a connection pool. one ACA, one client.
this.hostIpGrpcChannelStubMap = new ConcurrentHashMap();
logger.log(Level.FINE, "This instance has "+ numberOfGrpcChannelPerHost+" channels, and "+ numberOfWarmupsPerChannel+" warmups");

}

@Override
Expand Down Expand Up @@ -286,4 +288,4 @@ public GrpcChannelStub(ManagedChannel channel, GoalStateProvisionerGrpc.GoalStat
this.stub = stub;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ free of charge, to any person obtaining a copy of this software and associated d

@Component
@Configurable
@ComponentScan(value = "com.futurewei.alcor.netwconfigmanager.service")
public class GoalStateProvisionerServer implements NetworkConfigServer {
private static final Logger logger = LoggerFactory.getLogger();

Expand All @@ -70,8 +69,8 @@ public class GoalStateProvisionerServer implements NetworkConfigServer {
@Autowired
private GoalStatePersistenceService goalStatePersistenceService;

// @Autowired
// private GoalStateClient grpcGoalStateClient;
@Autowired
private GoalStateClient grpcGoalStateClient;

public GoalStateProvisionerServer() {
this.port = 9016; // TODO: make this configurable
Expand Down Expand Up @@ -163,8 +162,7 @@ public void onNext(Goalstate.GoalStateV2 value) {
// filter neighbor/SG update, and send them down to target ACA
try {
Map<String, HostGoalState> filteredGoalStates = NetworkConfigManagerUtil.filterNeighbors(hostGoalStates);

GoalStateClient grpcGoalStateClient = GoalStateClientImpl.getInstance(numberOfGrpcChannelPerHost, numberOfWarmupsPerChannel, monitorHosts);
GoalStateClient grpcGoalStateClient = GoalStateClientImpl.getInstance(numberOfGrpcChannelPerHost, numberOfWarmupsPerChannel, monitorHosts);

//TODO use filteredGoalStates
grpcGoalStateClient.sendGoalStates(hostGoalStates);
Expand Down Expand Up @@ -265,7 +263,6 @@ public void requestGoalStates(Goalstateprovisioner.HostRequest request,
hostGoalState.toString());
}
}

GoalStateClient grpcGoalStateClient = GoalStateClientImpl.getInstance(numberOfGrpcChannelPerHost, numberOfWarmupsPerChannel, monitorHosts);
long end = System.currentTimeMillis();
logger.log(Level.FINE, "requestGoalStates : Pushing GS with UUID: " + state_request_uuid + " at: " + end);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private String pushGoalState() {
hostGoalStates.get(DemoUtil.aca_node_one_ip).getGoalState().toString());

try {
GoalStateClient grpcGoalStateClient = new GoalStateClientImpl(1,1, new ArrayList<>());
GoalStateClient grpcGoalStateClient = new GoalStateClientImpl(1, 1, new ArrayList<>());
grpcGoalStateClient.sendGoalStates(hostGoalStates);
} catch (Exception e) {
e.printStackTrace();
Expand Down