use of org.onosproject.kubevirtnetworking.api.Constants.GW_ENTRY_TABLE in project onos by opennetworkinglab.
the class KubevirtPrometheusAssuranceManager method publishSnatMetrics.
private void publishSnatMetrics() {
if (prometheusExporter == null) {
log.error("Prometheus Server isn't ready.");
return;
}
String[] snatLabelValues = new String[3];
routerService.routers().stream().filter(router -> router.enableSnat() && router.electedGateway() != null && router.peerRouter() != null && router.peerRouter().ipAddress() != null && router.peerRouter().macAddress() != null).forEach(router -> {
KubevirtNode gateway = nodeService.node(router.electedGateway());
if (gateway == null) {
return;
}
String routerSnatIp = router.external().keySet().stream().findAny().orElse(null);
if (routerSnatIp == null) {
return;
}
flowRuleService.getFlowEntries(gateway.intgBridge()).forEach(flowEntry -> {
if (((IndexTableId) flowEntry.table()).id() == GW_ENTRY_TABLE && flowEntry.priority() == PRIORITY_STATEFUL_SNAT_RULE) {
snatLabelValues[0] = router.name();
snatLabelValues[1] = routerSnatIp;
snatLabelValues[2] = gateway.hostname();
if (isSnatUpstreamFlorEntryForRouter(router, flowEntry)) {
pktSNATTx.labels(snatLabelValues).set(flowEntry.packets());
byteSNATTx.labels(snatLabelValues).set(flowEntry.bytes());
} else if (isSnatDownstreamFlorEntryForRouter(routerSnatIp, flowEntry)) {
pktSNATRx.labels(snatLabelValues).set(flowEntry.packets());
byteSNATRx.labels(snatLabelValues).set(flowEntry.bytes());
}
}
});
});
}
use of org.onosproject.kubevirtnetworking.api.Constants.GW_ENTRY_TABLE in project onos by opennetworkinglab.
the class KubevirtFlowRuleManager method initializeGatewayNodePipeline.
protected void initializeGatewayNodePipeline(KubevirtNode kubevirtNode) {
DeviceId deviceId = kubevirtNode.intgBridge();
// for inbound to gateway entry table transition
connectTables(deviceId, STAT_INBOUND_TABLE, GW_ENTRY_TABLE);
// for gateway entry to gateway drop table transition
connectTables(deviceId, GW_ENTRY_TABLE, GW_DROP_TABLE);
// for setting up default gateway drop table
setupGatewayNodeDropTable(deviceId);
// for setting up default Forwarding table behavior which is NORMAL
setupNormalTable(deviceId, FORWARDING_TABLE);
kubevirtNode.phyIntfs().stream().filter(intf -> intf.physBridge() != null).forEach(phyIntf -> {
setupNormalTable(phyIntf.physBridge(), STAT_INBOUND_TABLE);
});
}
Aggregations