├── .gitignore ├── .gitmodules ├── .gitreview ├── .travis.yml ├── .travis ├── asan-build.sh ├── coveralls-deploy.sh ├── travis-build.sh └── tsan-build.sh ├── INFO.yaml ├── LICENSE ├── README.md ├── agent-ovs ├── .gitignore ├── Makefile.am ├── ReadmeTest.txt ├── autogen.sh ├── cmd │ ├── gbp_inspect.cpp │ ├── integration-test │ │ └── integration_test.cpp │ ├── mcast_daemon.cpp │ ├── opflex_agent.cpp │ └── test │ │ ├── GbpClient.cpp │ │ ├── Policies.cpp │ │ ├── agent_test.cpp │ │ ├── framework_stress.cpp │ │ ├── gbp.proto │ │ ├── gbp_client_stress.cpp │ │ ├── include │ │ ├── GbpClient.h │ │ └── Policies.h │ │ ├── opflex_server.cpp │ │ └── policy_repo_stress.cpp ├── configure.ac ├── configure.commit ├── debian │ ├── 10-opflex-agent-openvswitch.conf │ ├── changelog.in │ ├── compat │ ├── control │ ├── copyright │ ├── libopflex-agent-dev.install │ ├── libopflex-agent.install │ ├── libopflex-agent.shlibs │ ├── mcast-daemon.conf │ ├── mcast-daemon.service │ ├── opflex-agent-renderer-openvswitch.install │ ├── opflex-agent.dirs │ ├── opflex-agent.install │ ├── opflex-agent.postinst │ ├── opflex-agent.preinst │ ├── opflex-agent.service │ ├── opflex-agent.upstart │ ├── rules.in │ └── source │ │ └── format ├── doc │ └── Doxyfile.in ├── grafana │ ├── Contract.json │ ├── EastWestLB.json │ ├── Ep.json │ ├── ExternalLB.json │ ├── NodePortLB.json │ ├── Peer.json │ ├── PodSvc.json │ ├── SecGrp.json │ └── TableDrops.json ├── lib │ ├── Agent.cpp │ ├── AgentLogHandler.cpp │ ├── CtZoneManager.cpp │ ├── Endpoint.cpp │ ├── EndpointManager.cpp │ ├── EndpointSource.cpp │ ├── ExtraConfigManager.cpp │ ├── FSEndpointSource.cpp │ ├── FSExternalEndpointSource.cpp │ ├── FSLearningBridgeSource.cpp │ ├── FSPacketDropLogConfigSource.cpp │ ├── FSRDConfigSource.cpp │ ├── FSServiceSource.cpp │ ├── FSSnatSource.cpp │ ├── FSWatcher.cpp │ ├── IdGenerator.cpp │ ├── LearningBridgeIface.cpp │ ├── LearningBridgeManager.cpp │ ├── LearningBridgeSource.cpp │ ├── ModelEndpointSource.cpp │ ├── MulticastListener.cpp │ ├── NetFlowManager.cpp │ ├── Network.cpp │ ├── NotifServer.cpp │ ├── PolicyManager.cpp │ ├── PrometheusManager.cpp │ ├── RDConfig.cpp │ ├── Renderer.cpp │ ├── Service.cpp │ ├── ServiceManager.cpp │ ├── ServiceSource.cpp │ ├── SimStats.cpp │ ├── Snat.cpp │ ├── SnatManager.cpp │ ├── SnatSource.cpp │ ├── SpanManager.cpp │ ├── TaskQueue.cpp │ ├── TunnelEpManager.cpp │ ├── cmd.cpp │ ├── include │ │ └── opflexagent │ │ │ ├── Agent.h │ │ │ ├── AgentLogHandler.h │ │ │ ├── Endpoint.h │ │ │ ├── EndpointListener.h │ │ │ ├── EndpointManager.h │ │ │ ├── EndpointSource.h │ │ │ ├── ExporterConfigState.h │ │ │ ├── ExtraConfigListener.h │ │ │ ├── ExtraConfigManager.h │ │ │ ├── FSEndpointSource.h │ │ │ ├── FSExternalEndpointSource.h │ │ │ ├── FSLearningBridgeSource.h │ │ │ ├── FSPacketDropLogConfigSource.h │ │ │ ├── FSRDConfigSource.h │ │ │ ├── FSServiceSource.h │ │ │ ├── FSSnatSource.h │ │ │ ├── FSWatcher.h │ │ │ ├── Faults.h │ │ │ ├── IdGenerator.h │ │ │ ├── KeyedRateLimiter.h │ │ │ ├── LearningBridgeIface.h │ │ │ ├── LearningBridgeListener.h │ │ │ ├── LearningBridgeManager.h │ │ │ ├── LearningBridgeSource.h │ │ │ ├── ModelEndpointSource.h │ │ │ ├── MulticastListener.h │ │ │ ├── NetFlowListener.h │ │ │ ├── NetFlowManager.h │ │ │ ├── Network.h │ │ │ ├── NotifServer.h │ │ │ ├── PacketDropLogConfig.h │ │ │ ├── PolicyListener.h │ │ │ ├── PolicyManager.h │ │ │ ├── PrometheusManager.h │ │ │ ├── RDConfig.h │ │ │ ├── Renderer.h │ │ │ ├── Service.h │ │ │ ├── ServiceListener.h │ │ │ ├── ServiceManager.h │ │ │ ├── ServiceSource.h │ │ │ ├── SimStats.h │ │ │ ├── Snat.h │ │ │ ├── SnatListener.h │ │ │ ├── SnatManager.h │ │ │ ├── SnatSource.h │ │ │ ├── SpanListener.h │ │ │ ├── SpanManager.h │ │ │ ├── SpanSessionState.h │ │ │ ├── TaskQueue.h │ │ │ ├── TunnelEpManager.h │ │ │ ├── cmd.h │ │ │ ├── logging.h │ │ │ └── test │ │ │ ├── BaseFixture.h │ │ │ ├── MockEndpointSource.h │ │ │ └── ModbFixture.h │ ├── integration-test │ │ └── ctzone_test.cpp │ ├── logging.cpp │ └── test │ │ ├── EndpointManager_test.cpp │ │ ├── ExtraConfigManager_test.cpp │ │ ├── IdGenerator_test.cpp │ │ ├── KeyedRateLimiter_test.cpp │ │ ├── LearningBridgeManager_test.cpp │ │ ├── ModelEndpointSource_test.cpp │ │ ├── NetflowManager_test.cpp │ │ ├── Network_test.cpp │ │ ├── NotifServer_test.cpp │ │ ├── PolicyManagerIvLeaf_test.cpp │ │ ├── PolicyManager_test.cpp │ │ ├── ServiceManager_test.cpp │ │ ├── SimStats_test.cpp │ │ └── SpanManager_test.cpp ├── libopflex_agent.pc.in ├── m4 │ ├── ax_boost_asio.m4 │ ├── ax_boost_base.m4 │ ├── ax_boost_date_time.m4 │ ├── ax_boost_filesystem.m4 │ ├── ax_boost_iostreams.m4 │ ├── ax_boost_log.m4 │ ├── ax_boost_log_setup.m4 │ ├── ax_boost_program_options.m4 │ ├── ax_boost_system.m4 │ ├── ax_boost_unit_test_framework.m4 │ └── ax_cxx_compile_stdcxx.m4 ├── opflex-agent-ovs.conf.in ├── ovs │ ├── AccessFlowManager.cpp │ ├── ActionBuilder.cpp │ ├── AdvertManager.cpp │ ├── ContractStatsManager.cpp │ ├── FlowBuilder.cpp │ ├── FlowConstants.cpp │ ├── FlowExecutor.cpp │ ├── FlowReader.cpp │ ├── FlowUtils.cpp │ ├── IntFlowManager.cpp │ ├── InterfaceStatsManager.cpp │ ├── JsonRpc.cpp │ ├── JsonRpcRenderer.cpp │ ├── JsonRpcTransactMessage.cpp │ ├── NetFlowRenderer.cpp │ ├── OVSRenderer.cpp │ ├── OvsdbConnection.cpp │ ├── PacketDecoder.cpp │ ├── PacketDecoderLayers.cpp │ ├── PacketInHandler.cpp │ ├── PacketLogHandler.cpp │ ├── Packets.cpp │ ├── PolicyStatsManager.cpp │ ├── PortMapper.cpp │ ├── RangeMask.cpp │ ├── SecGrpStatsManager.cpp │ ├── ServiceStatsManager.cpp │ ├── SpanRenderer.cpp │ ├── SwitchConnection.cpp │ ├── SwitchManager.cpp │ ├── SwitchStateHandler.cpp │ ├── TableDropStatsManager.cpp │ ├── TableState.cpp │ ├── include │ │ ├── AccessFlowManager.h │ │ ├── ActionBuilder.h │ │ ├── AdvertManager.h │ │ ├── ContractStatsManager.h │ │ ├── CtZoneManager.h │ │ ├── FlowBuilder.h │ │ ├── FlowConstants.h │ │ ├── FlowExecutor.h │ │ ├── FlowReader.h │ │ ├── FlowUtils.h │ │ ├── IntFlowManager.h │ │ ├── InterfaceStatsManager.h │ │ ├── JsonRpc.h │ │ ├── JsonRpcRenderer.h │ │ ├── JsonRpcTransactMessage.h │ │ ├── NetFlowRenderer.h │ │ ├── OVSRenderer.h │ │ ├── OvsdbConnection.h │ │ ├── PacketDecoder.h │ │ ├── PacketDecoderLayers.h │ │ ├── PacketInHandler.h │ │ ├── PacketLogHandler.h │ │ ├── Packets.h │ │ ├── PolicyStatsManager.h │ │ ├── PortMapper.h │ │ ├── RangeMask.h │ │ ├── SecGrpStatsManager.h │ │ ├── ServiceStatsManager.h │ │ ├── SpanRenderer.h │ │ ├── SwitchConnection.h │ │ ├── SwitchManager.h │ │ ├── SwitchStateHandler.h │ │ ├── TableDropStatsManager.h │ │ ├── TableState.h │ │ ├── arp.h │ │ ├── dhcp.h │ │ ├── eth.h │ │ ├── ovs-ofpbuf.h │ │ ├── ovs-ofputil.h │ │ ├── ovs-shim.h │ │ └── udp.h │ ├── integration-test │ │ ├── connection_test.cpp │ │ ├── flowmod_test.cpp │ │ └── include │ │ │ └── ConnectionFixture.h │ ├── ovs-shim.c │ └── test │ │ ├── AccessFlowManager_test.cpp │ │ ├── AdvertManager_test.cpp │ │ ├── ContractStatsManager_test.cpp │ │ ├── FlowExecutor_test.cpp │ │ ├── FlowManagerFixture.cpp │ │ ├── IntFlowManager_test.cpp │ │ ├── InterfaceStatsManager_test.cpp │ │ ├── MockFlowExecutor.cpp │ │ ├── MockRpcConnection.cpp │ │ ├── NetFlowRenderer_test.cpp │ │ ├── PacketDecoder_test.cpp │ │ ├── PacketInHandler_test.cpp │ │ ├── Packets_test.cpp │ │ ├── PortMapper_test.cpp │ │ ├── RangeMask_test.cpp │ │ ├── SecGrpStatsManager_test.cpp │ │ ├── ServiceStatsManager_test.cpp │ │ ├── SpanRenderer_test.cpp │ │ ├── TableDropStatsManager_test.cpp │ │ ├── TableState_test.cpp │ │ └── include │ │ ├── FlowManagerFixture.h │ │ ├── MockFlowExecutor.h │ │ ├── MockFlowReader.h │ │ ├── MockPacketLogHandler.h │ │ ├── MockPortMapper.h │ │ ├── MockRpcConnection.h │ │ ├── MockSwitchConnection.h │ │ ├── MockSwitchManager.h │ │ └── PolicyStatsManagerFixture.h ├── plugin-renderer-openvswitch.conf.in └── rpm │ ├── 90-opflex-agent-sysctl.conf │ ├── mcast-daemon.service │ ├── opflex-agent-openvswitch.conf │ ├── opflex-agent.service │ └── opflex-agent.spec.in ├── buildlcovreport.sh ├── docs ├── _static │ └── logo.png ├── agent-ovs-dev-guide.rst ├── agent-ovs-user-guide.rst ├── building_and_running.md ├── conf.py ├── conf.yaml ├── drop_logs.md ├── favicon.ico ├── genie-dev-guide.rst ├── index.rst ├── libopflex-dev-guide.rst └── requirements.txt ├── genie ├── .gitignore ├── MODEL │ ├── BASE │ │ ├── dmtree │ │ │ └── root.mdl │ │ ├── relator │ │ │ └── relator.mdl │ │ └── types │ │ │ ├── address │ │ │ └── address.mdl │ │ │ ├── ascii │ │ │ ├── char.mdl │ │ │ └── string.mdl │ │ │ ├── naming │ │ │ └── naming.mdl │ │ │ ├── reference │ │ │ └── reference.mdl │ │ │ └── scalar │ │ │ ├── 16bitInt.mdl │ │ │ ├── 32bitInt.mdl │ │ │ ├── 64bitInt.mdl │ │ │ ├── 8bitInt.mdl │ │ │ ├── bitmask.mdl │ │ │ └── enum.mdl │ ├── EXTENSIONS │ │ ├── GBP │ │ │ ├── ep.mdl │ │ │ ├── epgmapping.mdl │ │ │ └── extensions.mdl │ │ └── PROTO │ │ │ ├── arp.mdl │ │ │ ├── base.mdl │ │ │ ├── cdp.mdl │ │ │ ├── dfw.mdl │ │ │ ├── dhcp.mdl │ │ │ ├── domain.mdl │ │ │ ├── l2.mdl │ │ │ ├── l3.mdl │ │ │ ├── l4.mdl │ │ │ ├── lacp.mdl │ │ │ ├── lldp.mdl │ │ │ ├── netflow.mdl │ │ │ ├── span.mdl │ │ │ └── stp.mdl │ ├── OWNERSHIP │ │ └── own.mdl │ ├── SPECIFIC │ │ ├── DCI │ │ │ └── dci.mdl │ │ ├── EPR │ │ │ ├── ep.mdl │ │ │ ├── epdr.mdl │ │ │ ├── epdruniverse.mdl │ │ │ ├── inventory.mdl │ │ │ └── universe.mdl │ │ ├── GBP │ │ │ └── COMMON │ │ │ │ ├── action.mdl │ │ │ │ ├── classifier.mdl │ │ │ │ ├── contract.mdl │ │ │ │ ├── ep-group.mdl │ │ │ │ ├── external.mdl │ │ │ │ ├── fwd-l2.mdl │ │ │ │ ├── fwd-l3.mdl │ │ │ │ ├── group.mdl │ │ │ │ └── secgroup.mdl │ │ ├── OBSERVER │ │ │ ├── config.mdl │ │ │ ├── fault.mdl │ │ │ ├── observable.mdl │ │ │ ├── opflex.mdl │ │ │ └── universe.mdl │ │ ├── POLICY │ │ │ ├── component.mdl │ │ │ ├── definition.mdl │ │ │ ├── space.mdl │ │ │ └── types.mdl │ │ └── SVC │ │ │ ├── attribute.mdl │ │ │ ├── mapping.mdl │ │ │ ├── nexthopip.mdl │ │ │ ├── service.mdl │ │ │ └── universe.mdl │ ├── SYNTAX │ │ ├── README-META-HOW-TO.txt │ │ ├── class │ │ │ └── class.meta │ │ ├── containment │ │ │ └── containment.meta │ │ ├── formatter │ │ │ └── formatter.meta │ │ ├── loader │ │ │ └── loader.meta │ │ ├── member │ │ │ ├── member-const.meta │ │ │ ├── member-group.meta │ │ │ ├── member-validate.meta │ │ │ └── member.meta │ │ ├── module │ │ │ └── module.meta │ │ ├── naming │ │ │ └── naming.meta │ │ ├── ownership │ │ │ └── ownership.meta │ │ ├── relation │ │ │ └── relation.meta │ │ └── type │ │ │ ├── primitive-const.meta │ │ │ ├── primitive-validate.meta │ │ │ ├── primitive.meta │ │ │ ├── type-const.meta │ │ │ ├── type-validate.meta │ │ │ └── type.meta │ ├── TEST2 │ │ ├── class-test.testmdl │ │ └── type-test.testmdl │ └── TEXTDEFINES │ │ ├── MODEL.txt │ │ ├── OPS-EXCEPTION-RULES-MODEL.txt │ │ └── SFC.txt ├── README.md ├── configs │ ├── genie.cfg │ ├── opflex │ │ ├── config.cfg │ │ ├── formatters │ │ │ └── formatter.cfg │ │ └── loaders │ │ │ └── loader.cfg │ ├── opproxy-java │ │ ├── config.cfg │ │ └── formatters │ │ │ └── formatter.cfg │ └── opproxy │ │ ├── config.cfg │ │ └── formatters │ │ └── formatter.cfg ├── headers │ └── defaulthdr.hdr ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── opendaylight │ └── opflex │ ├── genie │ ├── Genie.java │ ├── content │ │ ├── format │ │ │ ├── agent │ │ │ │ ├── build │ │ │ │ │ └── automake │ │ │ │ │ │ └── cpp │ │ │ │ │ │ ├── FAutogenSH.java │ │ │ │ │ │ ├── FAutomakeDef.java │ │ │ │ │ │ ├── FAxBoostBaseM4.java │ │ │ │ │ │ ├── FAxCxxCompileStdcxxM4.java │ │ │ │ │ │ ├── FConfigureAC.java │ │ │ │ │ │ ├── FDebPkg.java │ │ │ │ │ │ ├── FDoxygenIn.java │ │ │ │ │ │ ├── FLibPcIn.java │ │ │ │ │ │ └── FSpecIn.java │ │ │ │ ├── consts │ │ │ │ │ └── cpp │ │ │ │ │ │ └── FEnumDef.java │ │ │ │ ├── meta │ │ │ │ │ ├── cpp │ │ │ │ │ │ ├── FMetaAccessor.java │ │ │ │ │ │ └── FMetaDef.java │ │ │ │ │ └── mdl │ │ │ │ │ │ ├── FContDef.java │ │ │ │ │ │ └── FMetaDef.java │ │ │ │ └── structure │ │ │ │ │ └── cpp │ │ │ │ │ └── FClassDef.java │ │ │ └── proxy │ │ │ │ ├── build │ │ │ │ └── mvn │ │ │ │ │ └── FMvnDef.java │ │ │ │ ├── consts │ │ │ │ └── java │ │ │ │ │ └── FEnumDef.java │ │ │ │ ├── meta │ │ │ │ ├── cpp │ │ │ │ │ └── FMetaDef.java │ │ │ │ └── java │ │ │ │ │ └── FMetaDef.java │ │ │ │ └── structure │ │ │ │ ├── cpp │ │ │ │ └── FClassDef.java │ │ │ │ └── java │ │ │ │ └── FClassDef.java │ │ ├── model │ │ │ ├── mclass │ │ │ │ ├── DefinitionScope.java │ │ │ │ ├── MClass.java │ │ │ │ └── SubStructItem.java │ │ │ ├── mconst │ │ │ │ ├── ConstAction.java │ │ │ │ ├── ConstScope.java │ │ │ │ ├── MConst.java │ │ │ │ ├── MIndirection.java │ │ │ │ └── MValue.java │ │ │ ├── mcont │ │ │ │ ├── MChild.java │ │ │ │ ├── MContItem.java │ │ │ │ ├── MContRuleItem.java │ │ │ │ ├── MContained.java │ │ │ │ ├── MContainer.java │ │ │ │ └── MParent.java │ │ │ ├── mformatter │ │ │ │ ├── MFormatterDomain.java │ │ │ │ ├── MFormatterFeature.java │ │ │ │ └── MFormatterTask.java │ │ │ ├── mmeta │ │ │ │ ├── MNode.java │ │ │ │ ├── MNodeAlias.java │ │ │ │ ├── MNodeProp.java │ │ │ │ └── NodeType.java │ │ │ ├── mnaming │ │ │ │ ├── MNameComponent.java │ │ │ │ ├── MNameRule.java │ │ │ │ ├── MNamer.java │ │ │ │ └── NameRuleScope.java │ │ │ ├── module │ │ │ │ ├── Module.java │ │ │ │ └── SubModuleItem.java │ │ │ ├── mownership │ │ │ │ ├── DefinitionScope.java │ │ │ │ ├── MClassRule.java │ │ │ │ ├── MModuleRule.java │ │ │ │ ├── MOwned.java │ │ │ │ ├── MOwner.java │ │ │ │ ├── MOwnershipComponent.java │ │ │ │ └── MOwnershipRule.java │ │ │ ├── mprop │ │ │ │ ├── MProp.java │ │ │ │ └── PropAction.java │ │ │ ├── mrelator │ │ │ │ ├── MRelated.java │ │ │ │ ├── MRelationship.java │ │ │ │ ├── MRelationshipClass.java │ │ │ │ ├── MRelator.java │ │ │ │ ├── MRelatorItem.java │ │ │ │ ├── MRelatorRuleItem.java │ │ │ │ ├── MSource.java │ │ │ │ ├── MTarget.java │ │ │ │ ├── PointCardinality.java │ │ │ │ └── RelatorType.java │ │ │ ├── mtype │ │ │ │ ├── Language.java │ │ │ │ ├── MConstants.java │ │ │ │ ├── MConstraints.java │ │ │ │ ├── MLanguageBinding.java │ │ │ │ ├── MType.java │ │ │ │ ├── MTypeHint.java │ │ │ │ ├── PassBy.java │ │ │ │ ├── SubTypeItem.java │ │ │ │ └── TypeInfo.java │ │ │ └── mvalidation │ │ │ │ ├── MConstraint.java │ │ │ │ ├── MContentValidator.java │ │ │ │ ├── MContentValidatorParam.java │ │ │ │ ├── MRange.java │ │ │ │ ├── MValidator.java │ │ │ │ ├── ValidatorAction.java │ │ │ │ └── ValidatorScope.java │ │ └── parse │ │ │ ├── modlan │ │ │ └── ParseRegistry.java │ │ │ ├── pclass │ │ │ └── PClassNode.java │ │ │ ├── pconfig │ │ │ ├── PConfigNode.java │ │ │ ├── PFormatterNode.java │ │ │ ├── PLoaderNode.java │ │ │ └── PSyntaxNode.java │ │ │ ├── pconst │ │ │ └── PConstNode.java │ │ │ ├── pcontainment │ │ │ ├── PContainedNode.java │ │ │ └── PParentNode.java │ │ │ ├── pdataowner │ │ │ ├── PClassNode.java │ │ │ ├── PGroupNode.java │ │ │ ├── PMemberNode.java │ │ │ ├── PModuleNode.java │ │ │ └── POwnerNode.java │ │ │ ├── pformatter │ │ │ ├── PDomainNode.java │ │ │ ├── PFeatureNode.java │ │ │ └── PTaskNode.java │ │ │ ├── ploader │ │ │ ├── PDomainNode.java │ │ │ ├── PFeatureNode.java │ │ │ └── PIncludeNode.java │ │ │ ├── pmeta │ │ │ ├── PAlias.java │ │ │ ├── PNode.java │ │ │ └── PProp.java │ │ │ ├── pmodule │ │ │ └── PModuleNode.java │ │ │ ├── pnaming │ │ │ ├── PComponentNode.java │ │ │ ├── PNamedNode.java │ │ │ └── PParentNode.java │ │ │ ├── pprop │ │ │ └── PMemberNode.java │ │ │ ├── preference │ │ │ ├── PDependencyNode.java │ │ │ └── PToNode.java │ │ │ ├── ptype │ │ │ ├── PConstantsNode.java │ │ │ ├── PConstraintsNode.java │ │ │ ├── PHintNode.java │ │ │ ├── PLanguageNode.java │ │ │ └── PTypeNode.java │ │ │ └── pvalidation │ │ │ ├── PContentNode.java │ │ │ ├── PRangeNode.java │ │ │ └── PValidateNode.java │ └── engine │ │ ├── file │ │ ├── Lister.java │ │ ├── Reader.java │ │ └── Writer.java │ │ ├── format │ │ ├── BlockFormatDirective.java │ │ ├── FileNameRule.java │ │ ├── FileTypeMeta.java │ │ ├── FormattedFile.java │ │ ├── Formatter.java │ │ ├── FormatterCtx.java │ │ ├── FormatterDomainMeta.java │ │ ├── FormatterFeatureMeta.java │ │ ├── FormatterRegistry.java │ │ ├── FormatterTask.java │ │ ├── FormatterTaskMeta.java │ │ ├── FormatterTaskType.java │ │ ├── GenericFormatterTask.java │ │ ├── Header.java │ │ ├── HeaderLine.java │ │ ├── HeaderOption.java │ │ ├── Indenter.java │ │ └── ItemFormatterTask.java │ │ ├── model │ │ ├── Cardinality.java │ │ ├── Cat.java │ │ ├── CatEntry.java │ │ ├── Children.java │ │ ├── Ident.java │ │ ├── Item.java │ │ ├── Node.java │ │ ├── Pair.java │ │ ├── Relator.java │ │ └── RelatorCat.java │ │ ├── parse │ │ ├── load │ │ │ ├── LoadStage.java │ │ │ ├── LoaderDomainMeta.java │ │ │ ├── LoaderFeatureMeta.java │ │ │ ├── LoaderIncludeMeta.java │ │ │ └── LoaderRegistry.java │ │ ├── model │ │ │ ├── ParseNode.java │ │ │ ├── ParseNodeProp.java │ │ │ ├── ParseNodePropType.java │ │ │ ├── ProcessorNode.java │ │ │ └── ProcessorTree.java │ │ └── modlan │ │ │ ├── Node.java │ │ │ ├── ParseDirective.java │ │ │ ├── Processor.java │ │ │ ├── ProcessorRegistry.java │ │ │ └── Tree.java │ │ └── proc │ │ ├── Chnl.java │ │ ├── Config.java │ │ ├── Doer.java │ │ ├── Dsptchr.java │ │ ├── LoadTarget.java │ │ ├── Processor.java │ │ ├── SearchPath.java │ │ ├── Status.java │ │ └── Task.java │ └── modlan │ ├── parse │ ├── Attach.java │ ├── Consumer.java │ ├── Ctx.java │ ├── Data.java │ ├── Engine.java │ ├── Incl.java │ ├── LitBuff.java │ ├── Req.java │ ├── State.java │ ├── StateCtx.java │ ├── Transition.java │ └── TransitionTable.java │ ├── report │ ├── Reporter.java │ └── Severity.java │ └── utils │ └── Strings.java ├── libopflex-metadata ├── .gitignore ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── opendaylight │ │ └── opflex │ │ └── modb │ │ ├── ClassInfo.java │ │ ├── ConstInfo.java │ │ ├── EnumInfo.java │ │ ├── MAC.java │ │ ├── MO.java │ │ ├── ModelMetadata.java │ │ ├── PropertyInfo.java │ │ ├── URI.java │ │ └── URIBuilder.java │ └── test │ └── java │ └── org │ └── opendaylight │ └── opflex │ └── modb │ └── URIBuilderTest.java ├── libopflex ├── .clang_complete ├── .gitignore ├── Makefile.am ├── autogen.sh ├── comms │ ├── ActivePeer.cpp │ ├── ActiveTcpPeer.cpp │ ├── ActiveUnixPeer.cpp │ ├── CommunicationPeer.cpp │ ├── ListeningPeer.cpp │ ├── Makefile.am │ ├── active_connection.cpp │ ├── common.cpp │ ├── include │ │ ├── Makefile.am │ │ └── yajr │ │ │ ├── rpc │ │ │ ├── gen │ │ │ │ └── echo.hpp │ │ │ ├── internal │ │ │ │ ├── fnv_1a_64.hpp │ │ │ │ └── json_stream_wrappers.hpp │ │ │ ├── method_lookup.hpp │ │ │ └── methods.hpp │ │ │ └── transport │ │ │ └── ZeroCopyOpenSSL.hpp │ ├── loopdata.cpp │ ├── passive_listener.cpp │ ├── peer.cpp │ ├── rpc.cpp │ ├── rpc │ │ ├── handlers │ │ │ ├── error_response │ │ │ │ ├── echo.cpp │ │ │ │ └── unknown.cpp │ │ │ ├── request │ │ │ │ ├── echo.cpp │ │ │ │ └── unknown.cpp │ │ │ └── result_response │ │ │ │ ├── echo.cpp │ │ │ │ └── unknown.cpp │ │ └── message │ │ │ └── factory │ │ │ ├── inbounderror.cpp │ │ │ ├── inboundmessage.cpp │ │ │ ├── inboundrequest.cpp │ │ │ ├── inboundresult.cpp │ │ │ └── lookup_method.cpp │ ├── test │ │ ├── ca.pem │ │ ├── comms_test.cpp │ │ ├── handlers │ │ │ ├── error_response │ │ │ │ ├── custom.cpp │ │ │ │ ├── endpoint_declare.cpp │ │ │ │ ├── endpoint_resolve.cpp │ │ │ │ ├── endpoint_undeclare.cpp │ │ │ │ ├── endpoint_unresolve.cpp │ │ │ │ ├── endpoint_update.cpp │ │ │ │ ├── policy_resolve.cpp │ │ │ │ ├── policy_unresolve.cpp │ │ │ │ ├── policy_update.cpp │ │ │ │ ├── send_identity.cpp │ │ │ │ ├── state_report.cpp │ │ │ │ └── transact.cpp │ │ │ ├── list.grep │ │ │ ├── request │ │ │ │ ├── custom.cpp │ │ │ │ ├── endpoint_declare.cpp │ │ │ │ ├── endpoint_resolve.cpp │ │ │ │ ├── endpoint_undeclare.cpp │ │ │ │ ├── endpoint_unresolve.cpp │ │ │ │ ├── endpoint_update.cpp │ │ │ │ ├── policy_resolve.cpp │ │ │ │ ├── policy_unresolve.cpp │ │ │ │ ├── policy_update.cpp │ │ │ │ ├── send_identity.cpp │ │ │ │ ├── state_report.cpp │ │ │ │ └── transact.cpp │ │ │ └── result_response │ │ │ │ ├── custom.cpp │ │ │ │ ├── endpoint_declare.cpp │ │ │ │ ├── endpoint_resolve.cpp │ │ │ │ ├── endpoint_undeclare.cpp │ │ │ │ ├── endpoint_unresolve.cpp │ │ │ │ ├── endpoint_update.cpp │ │ │ │ ├── policy_resolve.cpp │ │ │ │ ├── policy_unresolve.cpp │ │ │ │ ├── policy_update.cpp │ │ │ │ ├── send_identity.cpp │ │ │ │ ├── state_report.cpp │ │ │ │ └── transact.cpp │ │ ├── main.cpp │ │ ├── server.pem │ │ └── stable_tests.sh │ └── transport │ │ ├── PlainText.cpp │ │ └── ZeroCopyOpenSSL.cpp ├── configure.ac ├── cwrapper │ ├── Makefile.am │ ├── offramework.cpp │ ├── ofloghandler.cpp │ ├── ofmutator.cpp │ ├── ofobjectlistener.cpp │ ├── ofpeerstatuslistener.cpp │ ├── ofuri.cpp │ └── test │ │ ├── Makefile.am │ │ ├── cwrapper_test.cpp │ │ └── main.cpp ├── debian │ ├── changelog.in │ ├── compat │ ├── control │ ├── copyright │ ├── libopflex-dev.install │ ├── libopflex.install │ ├── rules.in │ └── source │ │ └── format ├── doc │ ├── .gitignore │ ├── Doxyfile-internal.in │ └── Doxyfile.in ├── engine │ ├── AbstractObjectListener.cpp │ ├── GbpOpflexServer.cpp │ ├── Inspector.cpp │ ├── InspectorClientConn.cpp │ ├── InspectorClientHandler.cpp │ ├── InspectorClientImpl.cpp │ ├── InspectorServerHandler.cpp │ ├── MOSerializer.cpp │ ├── Makefile.am │ ├── OpflexClientConnection.cpp │ ├── OpflexConnection.cpp │ ├── OpflexHandler.cpp │ ├── OpflexListener.cpp │ ├── OpflexMessage.cpp │ ├── OpflexPEHandler.cpp │ ├── OpflexPool.cpp │ ├── OpflexServerConnection.cpp │ ├── OpflexServerHandler.cpp │ ├── Processor.cpp │ ├── include │ │ └── opflex │ │ │ └── engine │ │ │ ├── Inspector.h │ │ │ ├── InspectorClientImpl.h │ │ │ ├── Processor.h │ │ │ └── internal │ │ │ ├── AbstractObjectListener.h │ │ │ ├── GbpOpflexServerImpl.h │ │ │ ├── InspectorClientConn.h │ │ │ ├── InspectorClientHandler.h │ │ │ ├── InspectorServerHandler.h │ │ │ ├── MOSerializer.h │ │ │ ├── OpflexClientConnection.h │ │ │ ├── OpflexConnection.h │ │ │ ├── OpflexHandler.h │ │ │ ├── OpflexListener.h │ │ │ ├── OpflexMessage.h │ │ │ ├── OpflexPEHandler.h │ │ │ ├── OpflexPool.h │ │ │ ├── OpflexServerConnection.h │ │ │ ├── OpflexServerHandler.h │ │ │ └── ProcessorMessage.h │ └── test │ │ ├── MOSerialize_test.cpp │ │ ├── Makefile.am │ │ ├── OpflexPool_test.cpp │ │ ├── Processor_test.cpp │ │ └── main.cpp ├── include │ └── opflex │ │ ├── c │ │ ├── ofcore_c.h │ │ ├── offramework_c.h │ │ ├── ofloghandler_c.h │ │ ├── ofmutator_c.h │ │ ├── ofobjectlistener_c.h │ │ ├── ofpeerstatuslistener_c.h │ │ └── ofuri_c.h │ │ ├── gbp │ │ └── Policy.h │ │ ├── logging │ │ ├── OFLogHandler.h │ │ └── StdOutLogHandler.h │ │ ├── modb │ │ ├── ClassInfo.h │ │ ├── ConstInfo.h │ │ ├── EnumInfo.h │ │ ├── MAC.h │ │ ├── ModelMetadata.h │ │ ├── Mutator.h │ │ ├── ObjectListener.h │ │ ├── PropertyInfo.h │ │ ├── URI.h │ │ ├── URIBuilder.h │ │ └── mo-internal │ │ │ ├── MO.h │ │ │ ├── ObjectInstance.h │ │ │ └── StoreClient.h │ │ ├── ofcore │ │ ├── InspectorClient.h │ │ ├── MainLoopAdaptor.h │ │ ├── OFConstants.h │ │ ├── OFFramework.h │ │ ├── OFStats.h │ │ ├── OFTypes.h │ │ └── PeerStatusListener.h │ │ ├── rpc │ │ ├── JsonRpcConnection.h │ │ └── JsonRpcMessage.h │ │ ├── test │ │ └── GbpOpflexServer.h │ │ ├── util │ │ ├── LockGuard.h │ │ ├── RecursiveLockGuard.h │ │ └── ThreadManager.h │ │ └── yajr │ │ ├── internal │ │ └── comms.hpp │ │ ├── rpc │ │ ├── message_factory.hpp │ │ ├── rpc.hpp │ │ └── send_handler.hpp │ │ ├── transport │ │ ├── PlainText.hpp │ │ └── engine.hpp │ │ └── yajr.hpp ├── libopflex.pc.in ├── logging │ ├── Makefile.am │ ├── OFLogHandler.cpp │ ├── StdOutLogHandler.cpp │ ├── include │ │ └── opflex │ │ │ └── logging │ │ │ └── internal │ │ │ └── logging.hpp │ └── logging.cpp ├── m4 │ ├── attributes.m4 │ ├── ax_boost_asio.m4 │ ├── ax_boost_base.m4 │ ├── ax_boost_filesystem.m4 │ ├── ax_boost_system.m4 │ ├── ax_boost_unit_test_framework.m4 │ ├── ax_check_compile_flags.m4 │ ├── ax_compiler_vendor.m4 │ └── ax_cxx_compile_stdcxx.m4 ├── modb │ ├── ClassIndex.cpp │ ├── ClassInfo.cpp │ ├── EnumInfo.cpp │ ├── MAC.cpp │ ├── Makefile.am │ ├── ModelMetadata.cpp │ ├── Mutator.cpp │ ├── ObjectInstance.cpp │ ├── ObjectStore.cpp │ ├── PropertyInfo.cpp │ ├── Region.cpp │ ├── StoreClient.cpp │ ├── URI.cpp │ ├── URIBuilder.cpp │ ├── URIQueue.cpp │ ├── include │ │ └── opflex │ │ │ └── modb │ │ │ └── internal │ │ │ ├── ClassIndex.h │ │ │ ├── ObjectStore.h │ │ │ ├── Region.h │ │ │ └── URIQueue.h │ └── test │ │ ├── BaseFixture.h │ │ ├── MAC_test.cpp │ │ ├── MDFixture.h │ │ ├── Makefile.am │ │ ├── ObjectInstance_test.cpp │ │ ├── ObjectStore_test.cpp │ │ ├── TestListener.h │ │ ├── URIBuilder_test.cpp │ │ └── main.cpp ├── ofcore │ ├── MO.cpp │ ├── Makefile.am │ ├── OFFramework.cpp │ └── test │ │ ├── FrameworkFixture.h │ │ ├── Inspector_test.cpp │ │ ├── MO_test.cpp │ │ ├── Makefile.am │ │ ├── OFFramework_test.cpp │ │ ├── main.cpp │ │ └── testmodel │ │ ├── class1.h │ │ ├── class2.h │ │ ├── class3.h │ │ ├── class4.h │ │ └── class5.h ├── rpm │ └── libopflex.spec.in └── util │ ├── LockGuard.cpp │ ├── Makefile.am │ ├── RecursiveLockGuard.cpp │ └── ThreadManager.cpp ├── sample └── renderer │ ├── .gitignore │ ├── Makefile.am │ ├── SampleRenderer.cpp │ ├── SampleRenderer.h │ ├── SampleRenderer_test.cpp │ ├── autogen.sh │ ├── configure.ac │ ├── m4 │ ├── ax_boost_base.m4 │ ├── ax_boost_unit_test_framework.m4 │ └── ax_cxx_compile_stdcxx.m4 │ ├── plugin-renderer-sample.conf │ ├── rpm │ └── opflex-agent-renderer-sample.spec.in │ └── sample_test.cpp └── tox.ini /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | genie.iml 3 | .DS 4 | .DS_Store 5 | *~ 6 | .project 7 | .cproject 8 | .settings* 9 | 10 | # Sphinx documentation 11 | .tox/ 12 | docs/_build/ 13 | /build/ 14 | *.gcno 15 | *.gcda 16 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opendaylight/opflex/ae011a7c9d4bacd2a62465d24a8f51beae1d27cf/.gitmodules -------------------------------------------------------------------------------- /.gitreview: -------------------------------------------------------------------------------- 1 | [gerrit] 2 | host=git.opendaylight.org 3 | port=29418 4 | project=opflex.git 5 | defaultbranch=master 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c++ 2 | compiler: 3 | - gcc 4 | os: linux 5 | dist: bionic 6 | addons: 7 | apt: 8 | packages: 9 | - libuv1-dev 10 | - libboost-all-dev 11 | - libssl-dev 12 | - rapidjson-dev 13 | - autoconf 14 | - openjdk-8-jdk-headless 15 | - maven 16 | - texlive-font-utils 17 | - python-six 18 | - lcov 19 | 20 | before_install: 21 | - pip install --user cpp-coveralls 22 | 23 | before_script: sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'; 24 | 25 | env: 26 | - TEST_SUITE=travis-build.sh 27 | - TEST_SUITE=tsan-build.sh 28 | - TEST_SUITE=asan-build.sh 29 | 30 | script: bash ./.travis/$TEST_SUITE 31 | 32 | after_success: 33 | - bash ./.travis/coveralls-deploy.sh 34 | 35 | -------------------------------------------------------------------------------- /.travis/coveralls-deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$TEST_SUITE" == "travis-build.sh" ]; then 4 | lcov --capture --directory . --output-file coverage-all.info 5 | lcov --remove coverage-all.info -o coverage-all.info '/usr/include/*' '/usr/local/include/*' '*/test/*' 6 | coveralls --lcov-file coverage-all.info --exclude '/usr/include' --exclude '/usr/local/include' --exclude-pattern '.*/test/.*' --gcov-options '\-lp' > /dev/null 7 | fi 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # opflex 2 | 3 | [![Build Status](https://travis-ci.org/noironetworks/opflex.svg?branch=master)](https://travis-ci.org/noironetworks/opflex.svg?branch=master) 4 | [![Coverage Status](https://coveralls.io/repos/github/noironetworks/opflex/badge.svg?branch=master)](https://coveralls.io/github/noironetworks/opflex?branch=master) 5 | 6 | [Building and Running](docs/building_and_running.md) 7 | 8 | [Configuring and using drop logs](docs/drop_logs.md) 9 | 10 | -------------------------------------------------------------------------------- /agent-ovs/.gitignore: -------------------------------------------------------------------------------- 1 | build* 2 | Makefile 3 | Makefile.in 4 | core 5 | .deps 6 | .libs 7 | *.o 8 | *.lo 9 | *.la 10 | *_test 11 | install-sh 12 | libtool 13 | ltmain.sh 14 | missing 15 | cscope* 16 | config.guess 17 | autom4te.cache 18 | aclocal.m4 19 | config.h 20 | config.h.in 21 | config.log 22 | config.status 23 | config.sub 24 | configure 25 | depcomp 26 | *~ 27 | errors.err 28 | :q 29 | q 30 | :qa 31 | qa 32 | :wqa 33 | wqa 34 | stamp-h1 35 | libopflex.pc 36 | compile 37 | test-driver 38 | *.log 39 | *.trs 40 | m4/libtool.m4 41 | m4/lt*.m4 42 | .cproject 43 | .project 44 | .settings 45 | .tags 46 | .tags_sorted_by_file 47 | .dirstamp 48 | doc/Doxyfile 49 | doc/html 50 | doc/latex 51 | doc/doxygen_*.db 52 | agent_ovs 53 | agent_test 54 | mock_server 55 | *.rpm 56 | *.spec 57 | *.tar.gz 58 | opflex-agent-ovs.conf 59 | -------------------------------------------------------------------------------- /agent-ovs/cmd/integration-test/integration_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Integration test suite for OVS agent 3 | * 4 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 5 | * 6 | * This program and the accompanying materials are made available under the 7 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 8 | * and is available at http://www.eclipse.org/legal/epl-v10.html 9 | */ 10 | 11 | #define BOOST_TEST_MODULE "Integration OVS Agent" 12 | #include 13 | -------------------------------------------------------------------------------- /agent-ovs/cmd/test/agent_test.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Test suite for for OVS agent 4 | * 5 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #define BOOST_TEST_MODULE "OVS Agent" 13 | #include 14 | 15 | -------------------------------------------------------------------------------- /agent-ovs/cmd/test/gbp.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package gbpserver; 4 | 5 | // GBP service definition 6 | service GBP { 7 | // Obtains the objects currently in the policy database as a stream 8 | rpc ListObjects(Version) returns (stream GBPOperation) {} 9 | } 10 | 11 | // A GBPOperation adds, replaces or deletes a subtree 12 | message GBPOperation { 13 | enum OpCode { 14 | ADD = 0; 15 | REPLACE = 1; 16 | DELETE = 2; 17 | DELETE_RECURSIVE = 3; 18 | } 19 | 20 | OpCode opcode = 1; 21 | repeated GBPObject object_list = 2; 22 | } 23 | 24 | // Version is used for syncing between client and server 25 | message Version { 26 | int32 number = 1; 27 | } 28 | 29 | // GBPObject is a generic definition representing an object 30 | message GBPObject { 31 | string subject = 1; 32 | string uri = 2; 33 | repeated Property properties = 3; 34 | repeated string children = 4; 35 | string parent_subject = 5; 36 | string parent_uri = 6; 37 | string parent_relation = 7; 38 | } 39 | 40 | // Property is a name value pair, where the value could be one of [string, int, Reference] 41 | message Property { 42 | string name = 1; 43 | oneof value { 44 | string strVal = 2; 45 | int32 intVal = 3; 46 | Reference refVal = 4; 47 | } 48 | } 49 | 50 | // Reference refers to another GBP object 51 | message Reference { 52 | string subject = 1; 53 | string reference_uri = 2; 54 | } 55 | -------------------------------------------------------------------------------- /agent-ovs/cmd/test/include/Policies.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Include file for test policy writers 4 | * 5 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #include 13 | 14 | #pragma once 15 | #ifndef OPFLEXAGENT_TEST_POLICIES_H 16 | #define OPFLEXAGENT_TEST_POLICIES_H 17 | 18 | namespace opflexagent { 19 | 20 | /** 21 | * Write sample policies to an MODB 22 | */ 23 | class Policies { 24 | private: 25 | static void writeVrfUnEnforcedPolicy(opflex::ofcore::OFFramework& framework); 26 | public: 27 | static void writeBasicInit(opflex::ofcore::OFFramework& framework); 28 | static void writeTestPolicy(opflex::ofcore::OFFramework& framework); 29 | }; 30 | 31 | } /* namespace opflexagent */ 32 | 33 | #endif /* OPFLEXAGENT_TEST_POLICIES_H */ 34 | -------------------------------------------------------------------------------- /agent-ovs/configure.commit: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Display the SHA1 of the commit in which configure.ac was last modified. 3 | # If it's not checked in yet, use the SHA1 of HEAD plus -dirty. 4 | 5 | if [ ! -d ../.git ] ; then 6 | # if no .git directory, assume they're not using Git 7 | printf 'unknown commit' 8 | elif git diff --quiet HEAD -- configure.ac ; then 9 | # configure.ac is not modified 10 | printf 'commit %s' `git rev-list --max-count=1 HEAD -- configure.ac` 11 | else # configure.ac is modified 12 | printf 'commit %s -dirty' `git rev-parse HEAD` 13 | fi 14 | -------------------------------------------------------------------------------- /agent-ovs/debian/10-opflex-agent-openvswitch.conf: -------------------------------------------------------------------------------- 1 | [Unit] 2 | After=openvswitch.service 3 | Wants=openvswitch.service 4 | -------------------------------------------------------------------------------- /agent-ovs/debian/changelog.in: -------------------------------------------------------------------------------- 1 | opflex-agent (@PACKAGE_VERSION@-@BVERSION@) unstable; urgency=medium 2 | 3 | * OpFlex agent package 4 | 5 | -- Rob Adams Tue, 07 Jun 2016 13:45:13 -0700 6 | -------------------------------------------------------------------------------- /agent-ovs/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /agent-ovs/debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: agent-ovs 3 | Source: https://wiki.opendaylight.org/view/OpFlex:Main 4 | 5 | Files: * 6 | Copyright: Copyright 2015 Cisco Systems, Inc. 7 | License: Eclipse Public License v1.0 8 | 9 | -------------------------------------------------------------------------------- /agent-ovs/debian/libopflex-agent-dev.install: -------------------------------------------------------------------------------- 1 | usr/bin/opflex_server 2 | usr/lib/*/libopflex_agent.la 3 | usr/lib/*/libopflex_agent_renderer_openvswitch.la 4 | usr/lib/*/pkgconfig/* 5 | usr/include/opflexagent/ 6 | -------------------------------------------------------------------------------- /agent-ovs/debian/libopflex-agent.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/libopflex_agent.so* 2 | -------------------------------------------------------------------------------- /agent-ovs/debian/libopflex-agent.shlibs: -------------------------------------------------------------------------------- 1 | libopflex_agent 0 libopflex-agent (>= 2.2.0) 2 | -------------------------------------------------------------------------------- /agent-ovs/debian/mcast-daemon.conf: -------------------------------------------------------------------------------- 1 | description "Opflex Multicast Listener Daemon" 2 | 3 | start on started agent-ovs 4 | stop on stopped agent-ovs 5 | 6 | kill signal SIGINT 7 | 8 | respawn 9 | respawn limit 10 5 10 | 11 | pre-start script 12 | test -x /usr/bin/mcast_daemon || { stop; exit 0; } 13 | test -d /var/lib/opflex-agent-ovs/mcast/ || { stop; exit 0; } 14 | end script 15 | 16 | exec /usr/bin/mcast_daemon --syslog 17 | -------------------------------------------------------------------------------- /agent-ovs/debian/mcast-daemon.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Opflex Multicast Listener Daemon 3 | 4 | [Service] 5 | ExecStart=/usr/bin/mcast_daemon --syslog 6 | Restart=always 7 | 8 | [Install] 9 | WantedBy=multi-user.target 10 | -------------------------------------------------------------------------------- /agent-ovs/debian/opflex-agent-renderer-openvswitch.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/libopflex_agent_renderer_openvswitch.so* 2 | etc/opflex-agent-ovs/plugins.conf.d/plugin-renderer-openvswitch.conf 3 | debian/10-opflex-agent-openvswitch.conf /etc/systemd/system/opflex-agent.service.d/ 4 | -------------------------------------------------------------------------------- /agent-ovs/debian/opflex-agent.dirs: -------------------------------------------------------------------------------- 1 | var/lib/opflex-agent-ovs/endpoints 2 | var/lib/opflex-agent-ovs/services 3 | var/lib/opflex-agent-ovs/ids 4 | var/lib/opflex-agent-ovs/mcast 5 | var/lib/opflex-agent-ovs/droplog 6 | etc/opflex-agent-ovs/conf.d 7 | etc/opflex-agent-ovs/plugins.conf.d 8 | -------------------------------------------------------------------------------- /agent-ovs/debian/opflex-agent.install: -------------------------------------------------------------------------------- 1 | usr/bin/opflex_agent 2 | usr/bin/gbp_inspect 3 | usr/bin/mcast_daemon 4 | etc/opflex-agent-ovs/opflex-agent-ovs.conf 5 | debian/mcast-daemon.conf /etc/init/ 6 | debian/mcast-daemon.service /lib/systemd/system 7 | -------------------------------------------------------------------------------- /agent-ovs/debian/opflex-agent.preinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # preinst script for agent-ovs 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | # summary of how this script can be called: 9 | # * `install' 10 | # * `install' 11 | # * `upgrade' 12 | # * `abort-upgrade' 13 | # for details, see http://www.debian.org/doc/debian-policy/ or 14 | # the debian-policy package 15 | 16 | 17 | case "$1" in 18 | install|upgrade) 19 | getent group opflexep >/dev/null || groupadd -r opflexep 20 | ;; 21 | 22 | abort-upgrade) 23 | ;; 24 | 25 | *) 26 | echo "preinst called with unknown argument \`$1'" >&2 27 | exit 1 28 | ;; 29 | esac 30 | 31 | # dh_installdeb will replace this with shell code automatically 32 | # generated by other debhelper scripts. 33 | 34 | #DEBHELPER# 35 | 36 | exit 0 37 | -------------------------------------------------------------------------------- /agent-ovs/debian/opflex-agent.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=OpFlex group-based policy agent 3 | Wants=mcast-daemon.service 4 | 5 | [Service] 6 | ExecStart=/usr/bin/opflex_agent --syslog \ 7 | -c /etc/opflex-agent-ovs/opflex-agent-ovs.conf \ 8 | -c /etc/opflex-agent-ovs/plugins.conf.d \ 9 | -c /etc/opflex-agent-ovs/conf.d 10 | Restart=always 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | Alias=agent-ovs 15 | -------------------------------------------------------------------------------- /agent-ovs/debian/opflex-agent.upstart: -------------------------------------------------------------------------------- 1 | description "Opflex Agent" 2 | 3 | start on (local-filesystems) 4 | stop on runlevel [!2345] 5 | 6 | kill signal SIGINT 7 | 8 | respawn 9 | respawn limit 10 5 10 | 11 | pre-start script 12 | test -x /usr/bin/opflex-agent || { stop; exit 0; } 13 | test -e /etc/opflex-agent-ovs/opflex-agent-ovs.conf || { stop; exit 0; } 14 | end script 15 | 16 | exec /usr/bin/agent_ovs --syslog \ 17 | -c /etc/opflex-agent-ovs/opflex-agent-ovs.conf \ 18 | -c /etc/opflex-agent-ovs/plugins.conf.d \ 19 | -c /etc/opflex-agent-ovs/conf.d 20 | -------------------------------------------------------------------------------- /agent-ovs/debian/rules.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | 4 | # Uncomment this to turn on verbose mode. 5 | #export DH_VERBOSE=1 6 | 7 | PACKAGE=opflex-agent 8 | 9 | %: 10 | dh $@ --parallel --with autotools-dev,systemd 11 | 12 | override_dh_auto_configure: 13 | if [ -z $(filter norenderer,$(DEB_BUILD_PROFILES)) ]; then \ 14 | dh_auto_configure -- --disable-assert --disable-static --with-buildversion=@BVERSION@ ; \ 15 | else \ 16 | dh_auto_configure -- --disable-assert --disable-static --with-buildversion=@BVERSION@ --enable-renderer-ovs=no ;\ 17 | fi 18 | 19 | override_dh_auto_test: 20 | if ! make check; then find . -name test-suite.log -exec cat {} \; && false; fi 21 | 22 | override_dh_auto_install: 23 | $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install 24 | mkdir -p debian/libopflex-agent/DEBIAN/ 25 | install -m644 debian/libopflex-agent.shlibs \ 26 | debian/libopflex-agent/DEBIAN/shlibs 27 | 28 | override_dh_shlibdeps: 29 | dh_shlibdeps -- --warnings=0 30 | 31 | override_dh_strip: 32 | dh_strip --dbg-package=$(PACKAGE)-dbg 33 | 34 | override_dh_installinit: 35 | dh_installinit -R 36 | dh_systemd_enable -popflex-agent --name=mcast-daemon mcast-daemon.service 37 | dh_installinit -popflex-agent --name=mcast-daemon 38 | -------------------------------------------------------------------------------- /agent-ovs/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /agent-ovs/lib/EndpointSource.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Implementation for EndpointSource class. 4 | * 5 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #include 13 | #include 14 | 15 | namespace opflexagent { 16 | 17 | EndpointSource::EndpointSource(EndpointManager* manager_) 18 | : manager(manager_) {} 19 | 20 | EndpointSource::~EndpointSource() {} 21 | 22 | void EndpointSource::updateEndpoint(const Endpoint& endpoint) { 23 | manager->updateEndpoint(endpoint); 24 | } 25 | 26 | void EndpointSource::removeEndpoint(const std::string& uuid) { 27 | manager->removeEndpoint(uuid); 28 | } 29 | 30 | void EndpointSource::updateEndpointExternal(const Endpoint& endpoint) { 31 | manager->updateEndpointExternal(endpoint); 32 | } 33 | 34 | void EndpointSource::removeEndpointExternal(const std::string& uuid) { 35 | manager->removeEndpointExternal(uuid); 36 | } 37 | } /* namespace opflexagent */ 38 | -------------------------------------------------------------------------------- /agent-ovs/lib/LearningBridgeSource.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Implementation for LearningBridgeSource class. 4 | * 5 | * Copyright (c) 2018 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #include 13 | #include 14 | 15 | namespace opflexagent { 16 | 17 | LearningBridgeSource::LearningBridgeSource(LearningBridgeManager* manager_) 18 | : manager(manager_) {} 19 | 20 | LearningBridgeSource::~LearningBridgeSource() {} 21 | 22 | void LearningBridgeSource:: 23 | updateLBIface(const LearningBridgeIface& learningBridgeIface) { 24 | manager->updateLBIface(learningBridgeIface); 25 | } 26 | 27 | void LearningBridgeSource::removeLBIface(const std::string& uuid) { 28 | manager->removeLBIface(uuid); 29 | } 30 | 31 | } /* namespace opflexagent */ 32 | -------------------------------------------------------------------------------- /agent-ovs/lib/RDConfig.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Implementation for RDConfig class. 4 | * 5 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #include 13 | 14 | namespace opflexagent { 15 | 16 | std::ostream & operator<<(std::ostream &os, const RDConfig& s) { 17 | os << "RDConfig[" 18 | << "rdURI=" << s.getDomainURI(); 19 | 20 | if (s.getInternalSubnets().size() > 0) { 21 | bool first = true; 22 | os << ",internalSubnets=["; 23 | for (const std::string& sn : s.getInternalSubnets()) { 24 | if (first) first = false; 25 | else os << ","; 26 | os << sn; 27 | } 28 | os << "]"; 29 | } 30 | os << "]"; 31 | 32 | return os; 33 | } 34 | 35 | } /* namespace opflexagent */ 36 | -------------------------------------------------------------------------------- /agent-ovs/lib/Renderer.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Implementation for Renderer class 4 | * 5 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #include 13 | 14 | namespace opflexagent { 15 | 16 | 17 | Renderer::Renderer(Agent& agent_) 18 | : agent(agent_) { 19 | 20 | } 21 | 22 | Renderer::~Renderer() { 23 | } 24 | 25 | } /* namespace opflexagent */ 26 | -------------------------------------------------------------------------------- /agent-ovs/lib/ServiceSource.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Implementation for ServiceSource class. 4 | * 5 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #include 13 | #include 14 | 15 | namespace opflexagent { 16 | 17 | ServiceSource::ServiceSource(ServiceManager* manager_) 18 | : manager(manager_) {} 19 | 20 | ServiceSource::~ServiceSource() {} 21 | 22 | void ServiceSource::updateService(const Service& service) { 23 | manager->updateService(service); 24 | } 25 | 26 | void ServiceSource::removeService(const std::string& uuid) { 27 | manager->removeService(uuid); 28 | } 29 | 30 | } /* namespace opflexagent */ 31 | -------------------------------------------------------------------------------- /agent-ovs/lib/SnatSource.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Implementation for SnatSource class. 4 | * 5 | * Copyright (c) 2019 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #include 13 | #include 14 | 15 | namespace opflexagent { 16 | 17 | SnatSource::SnatSource(SnatManager* manager_) 18 | : manager(manager_) {} 19 | 20 | SnatSource::~SnatSource() {} 21 | 22 | void SnatSource::updateSnat(const Snat& snat) { 23 | manager->updateSnat(snat); 24 | } 25 | 26 | void SnatSource::removeSnat(const std::string& uuid) { 27 | manager->removeSnat(uuid); 28 | } 29 | 30 | } /* namespace opflexagent */ 31 | -------------------------------------------------------------------------------- /agent-ovs/lib/cmd.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Utility functions for command-line programs 4 | * 5 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | namespace opflexagent { 19 | 20 | void daemonize() 21 | { 22 | pid_t pid, sid; 23 | int fd; 24 | 25 | if ( getppid() == 1 ) return; 26 | pid = fork(); 27 | if (pid < 0) 28 | exit(1); 29 | 30 | if (pid > 0) 31 | exit(EXIT_SUCCESS); 32 | sid = setsid(); 33 | if (sid < 0) 34 | exit(1); 35 | if ((chdir("/")) < 0) 36 | exit(1); 37 | 38 | fd = open("/dev/null",O_RDWR, 0); 39 | 40 | if (fd != -1) { 41 | dup2 (fd, STDIN_FILENO); 42 | dup2 (fd, STDOUT_FILENO); 43 | dup2 (fd, STDERR_FILENO); 44 | if (fd > 2) 45 | close (fd); 46 | } 47 | umask(027); 48 | } 49 | 50 | } /* namespace opflexagent */ 51 | -------------------------------------------------------------------------------- /agent-ovs/lib/include/opflexagent/Faults.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Supported Faults. 4 | * 5 | * Copyright (c) 2019-2020 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #pragma once 13 | #ifndef __OPFLEXAGENT_FAULTS_H__ 14 | #define __OPFLEXAGENT_FAULTS_H__ 15 | 16 | namespace opflexagent { 17 | 18 | enum FaultCodes { 19 | SAMPLE_FAULT = 1, 20 | ENCAP_MISMATCH = 2 21 | }; 22 | } 23 | 24 | #endif -------------------------------------------------------------------------------- /agent-ovs/lib/include/opflexagent/NetFlowListener.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Include file for netflow Listener 4 | * 5 | * Copyright (c) 2019 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #pragma once 13 | #ifndef OPFLEX_NETFOWLISTENER_H 14 | #define OPFLEX_NETFOWLISTENER_H 15 | 16 | #include 17 | 18 | namespace opflexagent { 19 | 20 | using namespace std; 21 | 22 | /** 23 | * class defining api for listening to net flow updates 24 | */ 25 | class NetFlowListener { 26 | public: 27 | /** 28 | * destroy netflow listener and clean up all state. 29 | */ 30 | virtual ~NetFlowListener() {}; 31 | 32 | /** 33 | * called when netflow exporterconfig has been deleted 34 | * @param expSt exporter state 35 | */ 36 | virtual void exporterDeleted(const shared_ptr& expSt) {}; 37 | 38 | /** 39 | * Called when netflow objects are updated. 40 | */ 41 | virtual void exporterUpdated(const opflex::modb::URI&) {} 42 | }; 43 | } 44 | #endif // OPFLEX_NETFOWLISTENER_H 45 | -------------------------------------------------------------------------------- /agent-ovs/lib/include/opflexagent/ServiceListener.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Include file for service listener 4 | * 5 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #pragma once 13 | #ifndef OPFLEXAGENT_SERVICELISTENER_H 14 | #define OPFLEXAGENT_SERVICELISTENER_H 15 | 16 | namespace opflexagent { 17 | 18 | /** 19 | * An abstract interface for classes interested in updates related to 20 | * the services 21 | */ 22 | class ServiceListener { 23 | public: 24 | /** 25 | * Instantiate a new service listener 26 | */ 27 | ServiceListener() {}; 28 | 29 | /** 30 | * Destroy the service listener and clean up all state 31 | */ 32 | virtual ~ServiceListener() {}; 33 | 34 | /** 35 | * Called when a service is added, updated, or removed. 36 | * 37 | * @param uuid the UUID for the service 38 | */ 39 | virtual void serviceUpdated(const std::string& uuid) = 0; 40 | }; 41 | 42 | } /* namespace opflexagent */ 43 | 44 | #endif /* OPFLEXAGENT_SERVICELISTENER_H */ 45 | -------------------------------------------------------------------------------- /agent-ovs/lib/include/opflexagent/SnatListener.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Include file for snat listener 4 | * 5 | * Copyright (c) 2019 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #pragma once 13 | #ifndef OPFLEXAGENT_SNATLISTENER_H 14 | #define OPFLEXAGENT_SNATLISTENER_H 15 | 16 | namespace opflexagent { 17 | 18 | /** 19 | * An abstract interface for classes interested in updates related to 20 | * the snats 21 | */ 22 | class SnatListener { 23 | public: 24 | /** 25 | * Instantiate a new snat listener 26 | */ 27 | SnatListener() {}; 28 | 29 | /** 30 | * Destroy the snat listener and clean up all state 31 | */ 32 | virtual ~SnatListener() {}; 33 | 34 | /** 35 | * Called when a snat is added, updated, or removed. 36 | * 37 | * @param uuid the uuid of the snat object 38 | */ 39 | virtual void snatUpdated(const std::string& uuid) = 0; 40 | }; 41 | 42 | } /* namespace opflexagent */ 43 | 44 | #endif /* OPFLEXAGENT_SNATLISTENER_H */ 45 | -------------------------------------------------------------------------------- /agent-ovs/lib/include/opflexagent/SpanListener.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Include file for Span Listener 4 | * 5 | * Copyright (c) 2019 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #pragma once 13 | #ifndef OPFLEX_SPANLISTENER_H 14 | #define OPFLEX_SPANLISTENER_H 15 | 16 | #include 17 | 18 | namespace opflexagent { 19 | 20 | using namespace std; 21 | 22 | /** 23 | * class defining api for listening to span updates 24 | */ 25 | class SpanListener { 26 | public: 27 | /** 28 | * destroy span listener and clean up all state. 29 | */ 30 | virtual ~SpanListener() {}; 31 | 32 | /** 33 | * called when span session has been deleted 34 | * @param[in] seSt shared pointer to SessionState object 35 | */ 36 | virtual void spanDeleted(const shared_ptr& seSt) = 0; 37 | 38 | /** 39 | * Called when span objects are updated. 40 | */ 41 | virtual void spanUpdated(const opflex::modb::URI&) = 0; 42 | }; 43 | } 44 | #endif // OPFLEX_SPANLISTENER_H 45 | -------------------------------------------------------------------------------- /agent-ovs/lib/include/opflexagent/cmd.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Utility functions for command-line programs 4 | * 5 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | namespace opflexagent { 13 | 14 | /** 15 | * Daemonize a process 16 | */ 17 | void daemonize(); 18 | 19 | } /* namespace opflexagent */ 20 | -------------------------------------------------------------------------------- /agent-ovs/lib/include/opflexagent/test/MockEndpointSource.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Include file for mock endpoint source 4 | * 5 | * Copyright (c) 2020 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #pragma once 13 | #ifndef OPFLEXAGENT_TEST_MOCKENDPOINTSOURCE_H 14 | #define OPFLEXAGENT_TEST_MOCKENDPOINTSOURCE_H 15 | 16 | namespace opflexagent { 17 | 18 | /** 19 | * A Mock Endpoint Source 20 | */ 21 | class MockEndpointSource : public EndpointSource { 22 | public: 23 | /** 24 | * Construct a mock endpoint source 25 | */ 26 | MockEndpointSource(EndpointManager* manager) 27 | : EndpointSource(manager) { 28 | 29 | } 30 | 31 | virtual ~MockEndpointSource() { } 32 | }; 33 | 34 | } /* namespace opflexagent */ 35 | 36 | #endif /* OPFLEXAGENT_TEST_MOCKENDPOINTSOURCE_H */ 37 | -------------------------------------------------------------------------------- /agent-ovs/lib/test/KeyedRateLimiter_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Test suite for class KeyedRateLimiter 3 | * 4 | * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. 5 | * 6 | * This program and the accompanying materials are made available under the 7 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 8 | * and is available at http://www.eclipse.org/legal/epl-v10.html 9 | */ 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | namespace opflexagent { 20 | 21 | BOOST_AUTO_TEST_SUITE(KeyedRateLimiter_test) 22 | 23 | BOOST_AUTO_TEST_CASE(limit) { 24 | KeyedRateLimiter l; 25 | BOOST_CHECK(l.event("test")); 26 | BOOST_CHECK_EQUAL(false, l.event("test")); 27 | std::this_thread::sleep_for(std::chrono::milliseconds(30)); 28 | BOOST_CHECK_EQUAL(false, l.event("test")); 29 | std::this_thread::sleep_for(std::chrono::milliseconds(30)); 30 | BOOST_CHECK(l.event("test")); 31 | 32 | std::this_thread::sleep_for(std::chrono::milliseconds(55)); 33 | BOOST_CHECK(l.event("test")); 34 | } 35 | 36 | BOOST_AUTO_TEST_SUITE_END() 37 | 38 | } 39 | -------------------------------------------------------------------------------- /agent-ovs/libopflex_agent.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: @PACKAGE@ 7 | Description: OpFlex agent base library 8 | Version: @VERSION@ 9 | Requires.private: libopflex = @VERSION@ libmodelgbp = @VERSION@ 10 | Libs: -L${libdir} -lopflex_agent 11 | Libs.private: @LIBS@ 12 | Cflags: -I${includedir} @BOOST_CPPFLAGS@ 13 | -------------------------------------------------------------------------------- /agent-ovs/ovs/JsonRpcRenderer.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (c) 2014-2019 Cisco Systems, Inc. and others. All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under the 6 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 7 | * and is available at http://www.eclipse.org/legal/epl-v10.html 8 | */ 9 | 10 | #include "JsonRpcRenderer.h" 11 | #include 12 | 13 | namespace opflexagent { 14 | 15 | JsonRpcRenderer::JsonRpcRenderer(Agent& agent_) : 16 | agent(agent_), timerStarted(false), conn(nullptr) { 17 | } 18 | 19 | void JsonRpcRenderer::start(const std::string& swName, OvsdbConnection* conn_) { 20 | switchName = swName; 21 | conn = conn_; 22 | } 23 | 24 | bool JsonRpcRenderer::connect() { 25 | // connect to OVSDB, destination is specified in agent config file. 26 | // If not the default is applied 27 | // If connection fails, a timer is started to retry and 28 | // back off at periodic intervals. 29 | if (timerStarted) { 30 | LOG(DEBUG) << "Canceling timer"; 31 | connection_timer->cancel(); 32 | timerStarted = false; 33 | } 34 | jRpc = unique_ptr(new JsonRpc(conn)); 35 | jRpc->connect(); 36 | return jRpc->isConnected(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /agent-ovs/ovs/include/ovs-ofputil.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under the 6 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 7 | * and is available at http://www.eclipse.org/legal/epl-v10.html 8 | */ 9 | 10 | #include "ovs-ofpbuf.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | #define public publ 17 | #include 18 | #include 19 | #include 20 | #include 21 | #undef public 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | -------------------------------------------------------------------------------- /agent-ovs/ovs/include/udp.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Headers for the UDP protocol 4 | * 5 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #ifndef OPFLEXAGENT_UDP_H 13 | #define OPFLEXAGENT_UDP_H 14 | 15 | namespace opflexagent { 16 | namespace udp { 17 | 18 | /** 19 | * The UDP header 20 | */ 21 | struct udp_hdr { 22 | /** source port */ 23 | uint16_t src; 24 | /** destination port */ 25 | uint16_t dst; 26 | /** length of data + header */ 27 | uint16_t len; 28 | /** UDP checksum */ 29 | uint16_t chksum; 30 | }; 31 | 32 | } /* namespace udp */ 33 | } /* namespace opflexagent */ 34 | 35 | #endif /* OPFLEXAGENT_UDP_H */ 36 | -------------------------------------------------------------------------------- /agent-ovs/ovs/test/include/MockSwitchManager.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under the 6 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 7 | * and is available at http://www.eclipse.org/legal/epl-v10.html 8 | */ 9 | 10 | #ifndef OPFLEXAGENT_TEST_MOCKSWITCHMANAGER_H_ 11 | #define OPFLEXAGENT_TEST_MOCKSWITCHMANAGER_H_ 12 | 13 | #include "SwitchManager.h" 14 | #include "MockSwitchConnection.h" 15 | #include "MockPortMapper.h" 16 | #include "MockFlowExecutor.h" 17 | #include "MockFlowReader.h" 18 | 19 | namespace opflexagent { 20 | 21 | /** 22 | * Mock switch manager object useful for tests 23 | */ 24 | class MockSwitchManager : public SwitchManager { 25 | public: 26 | MockSwitchManager(Agent& agent, 27 | FlowExecutor& flowExecutor, 28 | FlowReader& flowReader, 29 | PortMapper& portMapper) : 30 | SwitchManager(agent, flowExecutor, flowReader, portMapper) {} 31 | 32 | virtual void start(const std::string& swName) { 33 | connection.reset(new MockSwitchConnection()); 34 | } 35 | }; 36 | 37 | } // namespace opflexagent 38 | 39 | #endif /* OPFLEXAGENT_TEST_MOCKSWITCHMANAGER_H_ */ 40 | -------------------------------------------------------------------------------- /agent-ovs/rpm/90-opflex-agent-sysctl.conf: -------------------------------------------------------------------------------- 1 | # Increase max IGMP memberships to allow VXLAN scaling 2 | # Increase socket buffer size to be able to support more IGMP joins 3 | net.ipv4.igmp_max_memberships=16535 4 | net.core.optmem_max=1310720 5 | net.core.wmem_max=1310720 6 | net.core.rmem_max=1310720 7 | -------------------------------------------------------------------------------- /agent-ovs/rpm/mcast-daemon.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Opflex Multicast Listener Daemon 3 | 4 | [Service] 5 | ExecStart=/usr/bin/mcast_daemon --syslog 6 | Restart=always 7 | 8 | [Install] 9 | WantedBy=multi-user.target 10 | -------------------------------------------------------------------------------- /agent-ovs/rpm/opflex-agent-openvswitch.conf: -------------------------------------------------------------------------------- 1 | [Unit] 2 | After=openvswitch.service 3 | Wants=openvswitch.service 4 | -------------------------------------------------------------------------------- /agent-ovs/rpm/opflex-agent.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=OpFlex group-based policy agent 3 | Wants=mcast-daemon.service 4 | 5 | [Service] 6 | ExecStart=/usr/bin/opflex_agent --syslog \ 7 | -c /etc/opflex-agent-ovs/opflex-agent-ovs.conf \ 8 | -c /etc/opflex-agent-ovs/plugins.conf.d \ 9 | -c /etc/opflex-agent-ovs/conf.d 10 | Restart=always 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | Alias=agent-ovs 15 | -------------------------------------------------------------------------------- /buildlcovreport.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | lcov --capture --directory . --output-file coverage-all.info --exclude "/usr/include*" --exclude "/usr/local/include/*" --exclude "*/test/*" 3 | genhtml coverage-all.info --output-directory out 4 | 5 | -------------------------------------------------------------------------------- /docs/_static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opendaylight/opflex/ae011a7c9d4bacd2a62465d24a8f51beae1d27cf/docs/_static/logo.png -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # SPDX-License-Identifier: EPL-1.0 4 | ############################################################################## 5 | # Copyright (c) 2018 The Linux Foundation and others. 6 | # 7 | # All rights reserved. This program and the accompanying materials 8 | # are made available under the terms of the Eclipse Public License v1.0 9 | # which accompanies this distribution, and is available at 10 | # http://www.eclipse.org/legal/epl-v10.html 11 | ############################################################################## 12 | 13 | from docs_conf.conf import * 14 | -------------------------------------------------------------------------------- /docs/conf.yaml: -------------------------------------------------------------------------------- 1 | project_cfg: opendaylight 2 | project: OPFLEX 3 | version: master 4 | -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opendaylight/opflex/ae011a7c9d4bacd2a62465d24a8f51beae1d27cf/docs/favicon.ico -------------------------------------------------------------------------------- /docs/genie-dev-guide.rst: -------------------------------------------------------------------------------- 1 | .. _opflex-genie-dev-guide: 2 | 3 | OpFlex genie Developer Guide 4 | ============================ 5 | 6 | Overview 7 | -------- 8 | 9 | Genie is a tool for code generation from a model. It supports generating 10 | C++ and Java code. C++ can be generated suitable for use with libopflex. 11 | C++ and Java can be generated as a plain set of objects. 12 | 13 | Group-based Policy Model 14 | ------------------------ 15 | 16 | The group-based policy model is included with the genie tool and can be 17 | found under the MODEL directory. By running mvn exec:java, libmodelgbp 18 | will be generated as a library project that, when built and installed, 19 | will work with libopflex. This model is used by the OVS agent. 20 | 21 | API Reference Documentation 22 | --------------------------- 23 | 24 | Complete API documentation for the generated libmodelgbp can be found 25 | in doc/html/index.html in any build 26 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. _opflex: 2 | 3 | ###### 4 | OPFLEX 5 | ###### 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | agent-ovs-dev-guide.rst 11 | agent-ovs-user-guide.rst 12 | genie-dev-guide.rst 13 | libopflex-dev-guide.rst 14 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | lfdocs-conf 2 | -------------------------------------------------------------------------------- /genie/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /GENTEST 3 | /opproxy-target 4 | .project 5 | .settings 6 | .classpath 7 | /genlog 8 | .idea 9 | genie.iml 10 | .DS 11 | .DS_Store 12 | *~ 13 | -------------------------------------------------------------------------------- /genie/MODEL/BASE/dmtree/root.mdl: -------------------------------------------------------------------------------- 1 | module[dmtree] 2 | { 3 | class[Root;concrete] 4 | } -------------------------------------------------------------------------------- /genie/MODEL/BASE/types/ascii/char.mdl: -------------------------------------------------------------------------------- 1 | module[ascii] 2 | { 3 | # 8 bit ascii character 4 | primitive[Char] 5 | { 6 | hint[ascii:char] 7 | language[cpp; 8 | syntax=unsigned char; 9 | pass-by=value; 10 | pass-const=yes] 11 | { 12 | constraints[default='\0'; 13 | min=0; 14 | max=127; 15 | size=8; 16 | ] 17 | 18 | constants[defined-in=ascii] 19 | } 20 | 21 | language[c; 22 | like=ascii/Char/cpp] 23 | 24 | language[java; 25 | syntax=char] 26 | { 27 | constraints[default=''] 28 | constants[defined-in=ascii] 29 | } 30 | } 31 | 32 | # 8 bit ascii text character 33 | primitive[TextChar; 34 | like=ascii/Char; 35 | ] 36 | { 37 | language[cpp] 38 | { 39 | constraints[min=32; 40 | max=126; 41 | default='/0' 42 | ] 43 | } 44 | language[c; 45 | like=ascii/TextChar/cpp] 46 | 47 | language[java; 48 | syntax=char] 49 | { 50 | constraints[default=''] 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /genie/MODEL/BASE/types/naming/naming.mdl: -------------------------------------------------------------------------------- 1 | module[naming] 2 | { 3 | type[Name; super=ascii/Name] 4 | 5 | type[Description; super=ascii/Description] 6 | 7 | primitive[Reference;like=ascii/String] 8 | 9 | primitive[URL; like=ascii/String] 10 | { 11 | hint[reference:URL] 12 | } 13 | } -------------------------------------------------------------------------------- /genie/MODEL/BASE/types/scalar/bitmask.mdl: -------------------------------------------------------------------------------- 1 | module[scalar] 2 | { 3 | primitive[Bitmask8; 4 | like=scalar/UInt8] 5 | { 6 | hint[bitmask] 7 | } 8 | 9 | primitive[Bitmask16; 10 | like=scalar/UInt16] 11 | { 12 | hint[bitmask] 13 | } 14 | 15 | primitive[Bitmask32; 16 | like=scalar/UInt32] 17 | { 18 | hint[bitmask] 19 | } 20 | 21 | primitive[Bitmask64; 22 | like=scalar/UInt64] 23 | { 24 | hint[bitmask] 25 | } 26 | } -------------------------------------------------------------------------------- /genie/MODEL/BASE/types/scalar/enum.mdl: -------------------------------------------------------------------------------- 1 | module[scalar] 2 | { 3 | primitive[Enum8; 4 | like=scalar/UInt8] 5 | { 6 | hint[enum] 7 | } 8 | 9 | primitive[Enum16; 10 | like=scalar/UInt16] 11 | { 12 | hint[enum] 13 | } 14 | 15 | primitive[Enum32; 16 | like=scalar/UInt32] 17 | { 18 | hint[enum] 19 | } 20 | 21 | primitive[Enum64; 22 | like=scalar/UInt64] 23 | { 24 | hint[enum] 25 | } 26 | } -------------------------------------------------------------------------------- /genie/MODEL/EXTENSIONS/GBP/ep.mdl: -------------------------------------------------------------------------------- 1 | module[gbpe] 2 | { 3 | class[EndpointRetention; 4 | super=policy/NameResolvedDefinition; 5 | concrete] 6 | { 7 | contained 8 | { 9 | parent[class=policy/Space] 10 | } 11 | named 12 | { 13 | parent[class=*;] 14 | { 15 | component[prefix=epret; 16 | member=name] 17 | } 18 | } 19 | 20 | member[holdInterval; type=scalar/UInt32] 21 | member[bounceAgingInterval; type=scalar/UInt32] 22 | member[localEpAgingInterval; type=scalar/UInt32] 23 | member[remoteEpAgingInterval; type=scalar/UInt32] 24 | member[moveFrequency; type=scalar/UInt32] 25 | } 26 | } -------------------------------------------------------------------------------- /genie/MODEL/EXTENSIONS/PROTO/arp.mdl: -------------------------------------------------------------------------------- 1 | module[arp] 2 | { 3 | type[Opcode; super=scalar/Enum8] 4 | { 5 | const[name=unspecified; value=0] 6 | const[name=request; value=1] 7 | const[name=reply; value=2] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /genie/MODEL/EXTENSIONS/PROTO/cdp.mdl: -------------------------------------------------------------------------------- 1 | module[cdp] 2 | { 3 | class[Config; 4 | super=platform/ConfigComponent; 5 | concrete] 6 | { 7 | member[state; type=platform/AdminState] 8 | } 9 | } -------------------------------------------------------------------------------- /genie/MODEL/EXTENSIONS/PROTO/dfw.mdl: -------------------------------------------------------------------------------- 1 | module[dfw] 2 | { 3 | class[Config; 4 | super=platform/ConfigComponent; 5 | concrete] 6 | { 7 | member[state; type=platform/AdminState] 8 | } 9 | 10 | # A set of counters for a network endpoint 11 | class[EpCounter; 12 | super=observer/UuidObservable; 13 | concrete; 14 | ] 15 | { 16 | contained 17 | { 18 | parent[class=observer/EpStatUniverse] 19 | } 20 | named 21 | { 22 | parent[class=*;] 23 | { 24 | component[member=uuid] 25 | } 26 | } 27 | # the number of received packets dropped 28 | member[rxDrop; type=scalar/UInt64] 29 | 30 | # the number of sent packets dropped 31 | member[txDrop; type=scalar/UInt64] 32 | } 33 | } -------------------------------------------------------------------------------- /genie/MODEL/EXTENSIONS/PROTO/domain.mdl: -------------------------------------------------------------------------------- 1 | module[domain] 2 | { 3 | class[Config; 4 | concrete] 5 | { 6 | root 7 | 8 | dependency[config; 9 | cardinality=single; 10 | ] 11 | { 12 | to[class=platform/Config; 13 | cardinality=many; 14 | ] 15 | } 16 | 17 | dependency[endpointInventory; 18 | cardinality=many; 19 | ] 20 | { 21 | to[class=inv/LocalEndpointInventory; 22 | cardinality=many; 23 | ] 24 | } 25 | 26 | dependency[remoteEndpointInventory; 27 | cardinality=single; 28 | ] 29 | { 30 | to[class=inv/RemoteEndpointInventory; 31 | cardinality=many; 32 | ] 33 | } 34 | 35 | named 36 | { 37 | parent[class=*;] 38 | { 39 | component[prefix=domain;] 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /genie/MODEL/EXTENSIONS/PROTO/l2.mdl: -------------------------------------------------------------------------------- 1 | module[l2] 2 | { 3 | type[Mtu; super=scalar/UInt32] 4 | type[EtherType; super=scalar/Enum16] 5 | { 6 | const[name=unspecified; value=0] 7 | const[name=trill; value=0x22F3] 8 | const[name=arp; value=0x0806] 9 | const[name=mpls_ucast; value=0x8847] 10 | const[name=mac_security; value=0x88E5] 11 | const[name=fcoe; value=0x8906] 12 | const[name=ipv4; value=0x0800] 13 | const[name=ipv6; value=0x86DD] 14 | } 15 | class[Config; 16 | super=platform/ConfigComponent; 17 | concrete] 18 | { 19 | member[state; type=l2/Mtu] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /genie/MODEL/EXTENSIONS/PROTO/l3.mdl: -------------------------------------------------------------------------------- 1 | module[l3] 2 | { 3 | type[IpProt; super=scalar/UInt8] 4 | } 5 | -------------------------------------------------------------------------------- /genie/MODEL/EXTENSIONS/PROTO/l4.mdl: -------------------------------------------------------------------------------- 1 | module[l4] 2 | { 3 | type[Port; super=scalar/UInt16] 4 | type[TcpFlags; super=scalar/Bitmask32] 5 | { 6 | # TCP flag unspecified 7 | const[name=unspecified; value=0x00] 8 | # TCP SYN flag 9 | const[name=SYN; value=0x01] 10 | # TCP ACK flag 11 | const[name=ACK; value=0x02] 12 | # TCP FIN flag 13 | const[name=FIN; value=0x04] 14 | # TCP RST flag 15 | const[name=RST; value=0x08] 16 | # Meta-flag matches against RST or ACK 17 | const[name=established; value=0x10] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /genie/MODEL/EXTENSIONS/PROTO/lacp.mdl: -------------------------------------------------------------------------------- 1 | module[lacp] 2 | { 3 | type[Mode; super=scalar/Enum8] 4 | { 5 | const[name=off; value=0] 6 | const[name=active; value=1] 7 | const[name=passive; value=2] 8 | const[name=mac-pin; value=3] 9 | } 10 | 11 | type[ControlBits; super=scalar/Bitmask8] 12 | { 13 | const[name=suspend-invididual-port; value=1] 14 | const[name=graceful-convergence; value=2] 15 | const[name=load-defer; value=4] 16 | const[name=fast-select-hot-standby; value=8] 17 | } 18 | 19 | class[Config; 20 | super=platform/ConfigComponent; 21 | concrete] 22 | { 23 | member[minLinks; type=scalar/UInt16] 24 | member[maxLinks; type=scalar/UInt16] 25 | member[mode; type=lacp/Mode] 26 | member[controlBits; type=lacp/ControlBits] 27 | } 28 | } -------------------------------------------------------------------------------- /genie/MODEL/EXTENSIONS/PROTO/lldp.mdl: -------------------------------------------------------------------------------- 1 | module[lldp] 2 | { 3 | class[Config; 4 | super=platform/ConfigComponent; 5 | concrete] 6 | { 7 | member[rx; type=platform/AdminState] 8 | member[tx; type=platform/AdminState] 9 | } 10 | } -------------------------------------------------------------------------------- /genie/MODEL/EXTENSIONS/PROTO/stp.mdl: -------------------------------------------------------------------------------- 1 | module[stp] 2 | { 3 | class[Config; 4 | super=platform/ConfigComponent; 5 | concrete] 6 | { 7 | member[bpduGuard; type=platform/AdminState] 8 | member[bpduFilter; type=platform/AdminState] 9 | } 10 | } -------------------------------------------------------------------------------- /genie/MODEL/SPECIFIC/GBP/COMMON/classifier.mdl: -------------------------------------------------------------------------------- 1 | module[gbp] 2 | { 3 | type[ConnTrack; super=scalar/Enum8] 4 | { 5 | # Match on traffic matching the classifier strictly 6 | const[name=normal; value=0] 7 | 8 | # Additionally match reverse traffic for connections 9 | const[name=reflexive; value=1] 10 | } 11 | 12 | class[Classifier; 13 | super=gbp/AccessBehavioralGroup; 14 | abstract] 15 | { 16 | contained 17 | { 18 | parent[class=policy/Space] 19 | } 20 | named 21 | { 22 | parent[class=*;] 23 | { 24 | component[prefix=classifier; 25 | member=name] 26 | } 27 | } 28 | 29 | member[order; type=scalar/UInt32] 30 | member[connectionTracking; type=gbp/ConnTrack] 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /genie/MODEL/SPECIFIC/GBP/COMMON/group.mdl: -------------------------------------------------------------------------------- 1 | module[gbp] 2 | { 3 | 4 | class[BehavioralGroup; 5 | super=policy/NameResolvedDefinition; 6 | abstract; 7 | ] 8 | 9 | class[ForwardingBehavioralGroup; 10 | super=gbp/BehavioralGroup; 11 | abstract; 12 | ] 13 | { 14 | dependency[subnets; 15 | cardinality=single;] 16 | { 17 | to[class=gbp/Subnets; 18 | cardinality=many; 19 | ] 20 | } 21 | } 22 | 23 | class[AccessBehavioralGroup; 24 | super=gbp/BehavioralGroup; 25 | abstract; 26 | ] 27 | } -------------------------------------------------------------------------------- /genie/MODEL/SPECIFIC/GBP/COMMON/secgroup.mdl: -------------------------------------------------------------------------------- 1 | module[gbp] 2 | { 3 | class[SecGroup; 4 | super=gbp/AccessBehavioralGroup; 5 | concrete] 6 | { 7 | contained 8 | { 9 | parent[class=policy/Space] 10 | } 11 | named 12 | { 13 | parent[class=*;] 14 | { 15 | component[prefix=secgroup; 16 | member=name] 17 | } 18 | } 19 | } 20 | 21 | class[SecGroupSubject; 22 | super=gbp/AccessBehavioralGroup; 23 | concrete] 24 | { 25 | contained 26 | { 27 | parent[class=gbp/SecGroup] 28 | } 29 | named 30 | { 31 | parent[class=*;] 32 | { 33 | component[prefix=subject; 34 | member=name] 35 | } 36 | } 37 | } 38 | 39 | class[SecGroupRule; 40 | super=gbp/Rule; 41 | concrete] 42 | { 43 | contained 44 | { 45 | parent[class=gbp/SecGroupSubject] 46 | } 47 | 48 | # Set of remote prefixes to which this rule applies. 49 | dependency[remoteAddress; 50 | cardinality=many; 51 | ] 52 | { 53 | to[class=gbp/Subnets; 54 | cardinality=many; 55 | ] 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /genie/MODEL/SPECIFIC/OBSERVER/observable.mdl: -------------------------------------------------------------------------------- 1 | module[observer] 2 | { 3 | class[Observable; 4 | abstract; 5 | ] 6 | 7 | class[UuidObservable; 8 | super=observer/Observable; 9 | abstract; 10 | ] 11 | { 12 | member[uuid; type=reference/UUID] 13 | } 14 | } -------------------------------------------------------------------------------- /genie/MODEL/SPECIFIC/POLICY/component.mdl: -------------------------------------------------------------------------------- 1 | module[policy] 2 | { 3 | class[Component; 4 | abstract; 5 | ] 6 | 7 | class[NamedComponent; 8 | super=policy/Component; 9 | abstract; 10 | ] 11 | { 12 | member[name; type=policy/Name] 13 | } 14 | 15 | class[NameResolvedComponent; 16 | super=policy/NamedComponent; 17 | abstract; 18 | ] 19 | } -------------------------------------------------------------------------------- /genie/MODEL/SPECIFIC/POLICY/definition.mdl: -------------------------------------------------------------------------------- 1 | module[policy] 2 | { 3 | class[Definition; 4 | abstract; 5 | ] 6 | 7 | class[NamedDefinition; 8 | super=policy/Definition; 9 | abstract; 10 | ] 11 | { 12 | member[name; type=policy/Name] 13 | } 14 | 15 | class[NameResolvedDefinition; 16 | super=policy/NamedDefinition; 17 | abstract; 18 | ] 19 | } -------------------------------------------------------------------------------- /genie/MODEL/SPECIFIC/POLICY/types.mdl: -------------------------------------------------------------------------------- 1 | module[policy] 2 | { 3 | type[Name; super=naming/Name] 4 | } -------------------------------------------------------------------------------- /genie/MODEL/SPECIFIC/SVC/attribute.mdl: -------------------------------------------------------------------------------- 1 | module[svc] 2 | { 3 | class[ServiceAttribute; 4 | super=policy/NamedDefinition; 5 | concrete] 6 | { 7 | contained 8 | { 9 | parent[class=svc/Service] 10 | } 11 | named 12 | { 13 | parent[class=*;] 14 | { 15 | component[member=name] 16 | } 17 | } 18 | 19 | # The value of the attribute represented as a string 20 | member[value; type=ascii/String] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /genie/MODEL/SPECIFIC/SVC/mapping.mdl: -------------------------------------------------------------------------------- 1 | module[svc] 2 | { 3 | type[ConnTrack; super=scalar/Enum8] 4 | { 5 | const[name=disabled; value=0] 6 | const[name=enabled; value=1] 7 | } 8 | 9 | # class to represent mappings of services present in the svc universe. 10 | class[ServiceMapping; 11 | concrete; 12 | ] 13 | { 14 | # IP of service mapping 15 | member[serviceIP; type=address/IP] 16 | 17 | # Proto of service mapping 18 | member[serviceProto; type=ascii/String] 19 | 20 | # IP of service gateway 21 | member[gatewayIP; type=address/IP] 22 | 23 | # Connection tracking - enabled or disabled 24 | member[connectionTracking; type=svc/ConnTrack] 25 | 26 | # service's L4 port 27 | member[servicePort; type=l4/Port] 28 | 29 | # Nexthop's L4 port 30 | member[nexthopPort; type=l4/Port] 31 | 32 | # NodePort value 33 | member[nodePort; type=l4/Port] 34 | 35 | contained 36 | { 37 | parent[class=svc/Service] 38 | } 39 | named 40 | { 41 | parent[class=*;] 42 | { 43 | component[member=serviceIP] 44 | component[prefix=-;member=serviceProto] 45 | component[prefix=-;member=servicePort] 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /genie/MODEL/SPECIFIC/SVC/nexthopip.mdl: -------------------------------------------------------------------------------- 1 | module[svc] 2 | { 3 | class[NexthopIP; 4 | concrete] 5 | { 6 | contained 7 | { 8 | parent[class=svc/ServiceMapping] 9 | } 10 | named 11 | { 12 | parent[class=*;] 13 | { 14 | component[member=ip] 15 | } 16 | } 17 | 18 | # The IP of nexthop represented as a string 19 | member[ip; type=address/IP] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /genie/MODEL/SPECIFIC/SVC/universe.mdl: -------------------------------------------------------------------------------- 1 | module[svc] 2 | { 3 | 4 | # Universe contains a set of corresponding services that are within the scope of 5 | # the given universe. 6 | class[Universe; 7 | abstract; 8 | ] 9 | { 10 | # All Universes are instantiated under the root 11 | root 12 | } 13 | 14 | # Universe containing Service objects 15 | class[ServiceUniverse; 16 | super=svc/Universe; 17 | concrete; 18 | ] 19 | { 20 | named 21 | { 22 | parent[class=*;] 23 | { 24 | component[] 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /genie/MODEL/SYNTAX/class/class.meta: -------------------------------------------------------------------------------- 1 | metadata 2 | { 3 | ref[module] 4 | { 5 | node[class] 6 | { 7 | alias[augment-class] 8 | qual[name] 9 | prop[super] 10 | option[abstract] 11 | option[concrete] 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /genie/MODEL/SYNTAX/formatter/formatter.meta: -------------------------------------------------------------------------------- 1 | metadata 2 | { 3 | node[formatter; 4 | generic; 5 | ] 6 | { 7 | node[domain; 8 | namespace=formatter] 9 | { 10 | qual[name; 11 | namespace=formatter] 12 | 13 | node[feature; 14 | namespace=formatter] 15 | { 16 | qual[name] 17 | 18 | node[task; 19 | namespace=formatter 20 | ] 21 | { 22 | qual[name] 23 | prop[target] 24 | prop[category] 25 | prop[relative-path] 26 | prop[file-type] 27 | prop[file-prefix] 28 | prop[file-suffix] 29 | prop[formatter] 30 | option[user] 31 | } 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /genie/MODEL/SYNTAX/loader/loader.meta: -------------------------------------------------------------------------------- 1 | metadata 2 | { 3 | node[loader; 4 | generic] 5 | { 6 | node[domain; 7 | namespace=loader] 8 | { 9 | qual[name; 10 | namespace=loader] 11 | 12 | node[feature; 13 | namespace=loader] 14 | { 15 | qual[name] 16 | 17 | node[include; 18 | namespace=loader] 19 | { 20 | qual[name] 21 | 22 | # directory where model files are 23 | prop[dir] 24 | # extension in format of .ext 25 | prop[ext] 26 | # stage can be pre-load, load or post-load 27 | prop[stage] 28 | } 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /genie/MODEL/SYNTAX/member/member-group.meta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opendaylight/opflex/ae011a7c9d4bacd2a62465d24a8f51beae1d27cf/genie/MODEL/SYNTAX/member/member-group.meta -------------------------------------------------------------------------------- /genie/MODEL/SYNTAX/member/member-validate.meta: -------------------------------------------------------------------------------- 1 | metadata 2 | { 3 | ref[module] 4 | { 5 | ref[class] 6 | { 7 | ref[member] 8 | { 9 | node[validate; 10 | use=module/type/validate] 11 | { 12 | node[range; 13 | use=module/type/validate/range] 14 | 15 | node[remove-range; 16 | use=module/type/validate/remove-range] 17 | 18 | node[content; 19 | use=module/type/validate/content] 20 | 21 | node[remove-content; 22 | use=module/type/validate/remove-content] 23 | } 24 | 25 | node[clobber-validate; 26 | use=module/type/clobber-validate 27 | ] 28 | { 29 | node[range; 30 | use=module/type/clobber-validate/range] 31 | node[content; 32 | use=module/type/clobber-validate/content] 33 | } 34 | 35 | node[remove-validate; 36 | use=module/type/remove-validate] 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /genie/MODEL/SYNTAX/module/module.meta: -------------------------------------------------------------------------------- 1 | metadata 2 | { 3 | node[module] 4 | { 5 | qual[name] 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /genie/MODEL/SYNTAX/ownership/ownership.meta: -------------------------------------------------------------------------------- 1 | metadata 2 | { 3 | node[owner; 4 | namespace=dataowner;] 5 | { 6 | qual[name] 7 | node[module; 8 | namespace=dataowner;] 9 | { 10 | qual[name] 11 | node[class; 12 | use=owner/class; 13 | namespace=dataowner;] 14 | { 15 | qual[name] 16 | node[member; 17 | use=owner/class/member; 18 | namespace=dataowner;] 19 | { 20 | 21 | } 22 | node[group; 23 | use=owner/class/member; 24 | namespace=dataowner;] 25 | { 26 | 27 | } 28 | } 29 | } 30 | 31 | node[class; 32 | namespace=dataowner;] 33 | { 34 | qual[name] 35 | 36 | node[member; 37 | namespace=dataowner;] 38 | { 39 | qual[name] 40 | } 41 | 42 | node[member-group; 43 | use=owner/group; 44 | namespace=dataowner;] 45 | { 46 | } 47 | } 48 | 49 | node[group; 50 | namespace=dataowner;] 51 | { 52 | qual[name] 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /genie/MODEL/SYNTAX/type/primitive-const.meta: -------------------------------------------------------------------------------- 1 | metadata 2 | { 3 | ref[module] 4 | { 5 | ref[primitive] 6 | { 7 | node[const; 8 | use=module/type/const] 9 | node[map-const; 10 | use=module/type/map-const] 11 | node[revertive-const; 12 | use=module/type/revertive-const] 13 | node[transitive-const; 14 | use=module/type/transitive-const] 15 | node[unsettable-const; 16 | use=module/type/unsettable-const] 17 | node[default; 18 | use=module/type/default] 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /genie/MODEL/SYNTAX/type/primitive-validate.meta: -------------------------------------------------------------------------------- 1 | metadata 2 | { 3 | ref[module] 4 | { 5 | ref[primitive] 6 | { 7 | node[validate; 8 | use=module/type/validate] 9 | { 10 | node[range; 11 | use=module/type/validate/range] 12 | 13 | node[content; 14 | use=module/type/validate/content] 15 | } 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /genie/MODEL/SYNTAX/type/type-const.meta: -------------------------------------------------------------------------------- 1 | metadata 2 | { 3 | ref[module] 4 | { 5 | ref[type] 6 | { 7 | node[const] 8 | { 9 | qual[name] 10 | prop[value] 11 | prop[target] 12 | } 13 | 14 | node[map-const; 15 | use=module/type/const] 16 | node[remove-const; 17 | use=module/type/const] 18 | node[revertive-const; 19 | use=module/type/const] 20 | node[transitive-const; 21 | use=module/type/const] 22 | node[unsettable-const; 23 | use=module/type/const] 24 | node[default; 25 | use=module/type/const] 26 | node[exclusive; 27 | use=module/type/const] 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /genie/MODEL/SYNTAX/type/type.meta: -------------------------------------------------------------------------------- 1 | metadata 2 | { 3 | ref[module] 4 | { 5 | node[type] 6 | { 7 | qual[name] 8 | prop[super] 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /genie/MODEL/TEST2/class-test.testmdl: -------------------------------------------------------------------------------- 1 | module[motest] 2 | { 3 | class[MoBase; 4 | abstract;] 5 | { 6 | 7 | } 8 | 9 | class[MoOne; 10 | concrete; 11 | super=motest/MoBase] 12 | { 13 | 14 | } 15 | } -------------------------------------------------------------------------------- /genie/README.md: -------------------------------------------------------------------------------- 1 | genie 2 | ===== 3 | 4 | code generation framework for model based control apps 5 | -------------------------------------------------------------------------------- /genie/configs/genie.cfg: -------------------------------------------------------------------------------- 1 | config[ 2 | libname=modelgbp; 3 | libversion=2.2.0; 4 | libtoolversion=14:0:14; 5 | syntax=MODEL/SYNTAX; 6 | loader=configs/opflex/loaders; 7 | formatter=configs/opflex/formatters; 8 | gendest=target; 9 | logfile=target/genlog; 10 | headerpath=headers/defaulthdr.hdr; 11 | ] 12 | -------------------------------------------------------------------------------- /genie/configs/opflex/config.cfg: -------------------------------------------------------------------------------- 1 | config[ 2 | libname=modelgbp; 3 | syntax=MODEL/SYNTAX; 4 | loader=configs/opflex/loaders; 5 | formatter=configs/opflex/formatters; 6 | gendest=target/; 7 | logfile=target/genlog; 8 | headerpath=headers/defaulthdr.hdr; 9 | ] -------------------------------------------------------------------------------- /genie/configs/opflex/loaders/loader.cfg: -------------------------------------------------------------------------------- 1 | loader 2 | { 3 | domain[base] 4 | { 5 | feature[model] 6 | { 7 | include[dir=MODEL/BASE; 8 | ext=.mdl; 9 | stage=pre; 10 | ] 11 | } 12 | } 13 | 14 | domain[model] 15 | { 16 | feature[structural-models] 17 | { 18 | include[dir=MODEL/SPECIFIC; 19 | ext=.mdl; 20 | stage=load; 21 | ] 22 | } 23 | 24 | feature[ownership] 25 | { 26 | include[dir=MODEL/OWNERSHIP; 27 | ext=.mdl; 28 | stage=load; 29 | ] 30 | } 31 | 32 | feature[model-extensions] 33 | { 34 | include[dir=MODEL/EXTENSIONS; 35 | ext=.mdl; 36 | stage=load; 37 | ] 38 | } 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /genie/configs/opproxy-java/config.cfg: -------------------------------------------------------------------------------- 1 | config[ 2 | libname=modelgbp; 3 | syntax=MODEL/SYNTAX; 4 | loader=configs/opflex/loaders; 5 | formatter=configs/opproxy-java/formatters; 6 | gendest=target; 7 | logfile=target/modelgbp-genlog; 8 | headerpath=headers/defaulthdr.hdr; 9 | ] -------------------------------------------------------------------------------- /genie/configs/opproxy/config.cfg: -------------------------------------------------------------------------------- 1 | config[ 2 | libname=opmodelgbp; 3 | syntax=MODEL/SYNTAX; 4 | loader=configs/opflex/loaders; 5 | formatter=configs/opproxy/formatters; 6 | gendest=opproxy-target/; 7 | logfile=opproxy-target/target/genlog; 8 | headerpath=headers/defaulthdr.hdr; 9 | ] -------------------------------------------------------------------------------- /genie/headers/defaulthdr.hdr: -------------------------------------------------------------------------------- 1 | 2 | SOME COPYRIGHT 3 | 4 | GENIE_VAR_FULL_FILE_NAME 5 | 6 | generated GENIE_VAR_FULL_FILE_NAME file genie code generation framework free of license. 7 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/Genie.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie; 2 | 3 | import org.opendaylight.opflex.genie.content.parse.modlan.ParseRegistry; 4 | import org.opendaylight.opflex.genie.engine.proc.Processor; 5 | 6 | /** 7 | * Created by midvorki on 3/10/14. 8 | */ 9 | public class Genie 10 | { 11 | /** 12 | * Genie main method. 13 | * arguments supported: 14 | * home=[home-directory] to indicate the target home directory to look for files etc. 15 | * config=[config-file-name] name of the config file 16 | * @param aInArgs a list of arguments from command line: arguments come in [[name]=[value]] or [name] format 17 | */ 18 | public static void main(String[] aInArgs) 19 | { 20 | // trigger the processing 21 | new Processor( 22 | ParseRegistry.init(), 23 | aInArgs 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mclass/DefinitionScope.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mclass; 2 | 3 | /** 4 | * Created by midvorki on 8/4/14. 5 | */ 6 | public enum DefinitionScope 7 | { 8 | CLASS, 9 | MODULE, 10 | NONE 11 | ; 12 | 13 | public static DefinitionScope get(String aIn) 14 | { 15 | for (DefinitionScope lScope : DefinitionScope.values()) 16 | { 17 | if (aIn.equalsIgnoreCase(lScope.toString())) 18 | { 19 | return lScope; 20 | } 21 | } 22 | return NONE; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mclass/SubStructItem.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mclass; 2 | 3 | import org.opendaylight.opflex.genie.content.model.module.SubModuleItem; 4 | import org.opendaylight.opflex.genie.engine.model.Cat; 5 | 6 | /** 7 | * Created by dvorkinista on 7/7/14. 8 | */ 9 | public class SubStructItem extends SubModuleItem 10 | { 11 | protected SubStructItem(Cat aInCat,MClass aInParent, String aInLName) 12 | { 13 | super(aInCat, aInParent, aInLName); 14 | } 15 | 16 | public MClass getMClass() 17 | { 18 | return MClass.getClass(this); 19 | } 20 | } -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mcont/MContRuleItem.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mcont; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Cat; 4 | import org.opendaylight.opflex.genie.engine.model.RelatorCat; 5 | 6 | /** 7 | * Created by dvorkinista on 7/8/14. 8 | * 9 | * Abstraction of the containment rule item, a superclass of rules specifying the relationship 10 | * with containment dependencies. 11 | */ 12 | 13 | public abstract class MContRuleItem 14 | extends MContItem 15 | { 16 | /** 17 | * Constructor 18 | * @param aInMyCat category of a containment item 19 | * @param aInParent parent item under which this item is created 20 | * @param aInTargetRelatorCat target class resolution category 21 | * @param aInTargetGname global name of the target class 22 | */ 23 | protected MContRuleItem( 24 | Cat aInMyCat, MContItem aInParent, RelatorCat aInTargetRelatorCat, String aInTargetGname) 25 | { 26 | super(aInMyCat, aInParent, aInTargetRelatorCat, aInTargetGname); 27 | } 28 | } -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mformatter/MFormatterFeature.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mformatter; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Cat; 4 | import org.opendaylight.opflex.genie.engine.model.Item; 5 | 6 | /** 7 | * Created by midvorki on 7/24/14. 8 | */ 9 | public class MFormatterFeature 10 | extends Item 11 | { 12 | /** 13 | * category of this item 14 | */ 15 | public static final Cat MY_CAT = Cat.getCreate("formatter:feature"); 16 | 17 | 18 | /** 19 | * Constructor 20 | * @param aInLName name of the feature 21 | */ 22 | public MFormatterFeature(MFormatterDomain aInDomain, String aInLName) 23 | { 24 | super(MY_CAT, aInDomain, aInLName); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mmeta/MNodeAlias.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mmeta; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Cat; 4 | import org.opendaylight.opflex.genie.engine.model.Item; 5 | 6 | /** 7 | * Created by midvorki on 10/22/14. 8 | */ 9 | public class MNodeAlias 10 | extends Item 11 | { 12 | /** 13 | * category of this item 14 | */ 15 | public static final Cat MY_CAT = Cat.getCreate("parser:meta:alias"); 16 | 17 | public MNodeAlias(MNode aInParent, String aInName) 18 | { 19 | super(MY_CAT, aInParent, aInName); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mmeta/MNodeProp.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mmeta; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Cat; 4 | import org.opendaylight.opflex.genie.engine.model.Item; 5 | import org.opendaylight.opflex.genie.engine.parse.model.ParseNodePropType; 6 | 7 | /** 8 | * Created by midvorki on 7/22/14. 9 | */ 10 | public class MNodeProp 11 | extends Item 12 | { 13 | /** 14 | * category of this item 15 | */ 16 | public static final Cat MY_CAT = Cat.getCreate("parser:meta:prop"); 17 | 18 | public MNodeProp(MNode aInParent, String aInName, ParseNodePropType aInType) 19 | { 20 | super(MY_CAT, aInParent, aInName); 21 | type = aInType; 22 | } 23 | 24 | public ParseNodePropType getType() 25 | { 26 | return type; 27 | } 28 | 29 | private final ParseNodePropType type; 30 | } 31 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mmeta/NodeType.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mmeta; 2 | 3 | /** 4 | * Created by midvorki on 7/22/14. 5 | */ 6 | public enum NodeType 7 | { 8 | NODE("node"), 9 | REFERENCE("ref") 10 | ; 11 | 12 | NodeType(String aInModelName) 13 | { 14 | modelName = aInModelName; 15 | } 16 | 17 | public String getName() 18 | { 19 | return modelName; 20 | } 21 | /** 22 | * stringifier 23 | */ 24 | public String toString() 25 | { 26 | return modelName; 27 | } 28 | 29 | private final String modelName; 30 | } 31 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mnaming/NameRuleScope.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mnaming; 2 | 3 | /** 4 | * Created by midvorki on 7/10/14. 5 | * 6 | * Identifies scope of a name rule; whether it applies to a specific container context or all unspecified containments. 7 | */ 8 | public enum NameRuleScope 9 | { 10 | /** 11 | * applies to any containing class that does not have specific rule 12 | */ 13 | ANY("any") 14 | ; 15 | 16 | /** 17 | * Constructor 18 | * @param aIn scope name 19 | */ 20 | NameRuleScope(String aIn) 21 | { 22 | name = aIn; 23 | } 24 | 25 | /** 26 | * name accessor 27 | * @return scope name 28 | */ 29 | public String getName() 30 | { 31 | return name; 32 | } 33 | 34 | /** 35 | * stringifier 36 | * @return return name 37 | */ 38 | public String toString() 39 | { 40 | return name; 41 | } 42 | 43 | private final String name; 44 | 45 | } 46 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/module/Module.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.module; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Cat; 4 | import org.opendaylight.opflex.genie.engine.model.Item; 5 | 6 | /** 7 | * Created by dvorkinista on 7/6/14. 8 | */ 9 | public class Module extends Item 10 | { 11 | public static final Cat MY_CAT = Cat.getCreate("module"); 12 | 13 | public static Module get(String aInName) 14 | { 15 | return get(aInName, false); 16 | } 17 | public static synchronized Module get(String aInName, boolean aInCreateIfNotFound) 18 | { 19 | Module lModule = (Module) MY_CAT.getItem(aInName); 20 | if (null == lModule && aInCreateIfNotFound) 21 | { 22 | 23 | if (null == MY_CAT.getItem(aInName)) 24 | { 25 | lModule = new Module(aInName); 26 | } 27 | } 28 | return lModule; 29 | } 30 | 31 | private Module(String aInLName) 32 | { 33 | super(MY_CAT, null, aInLName); 34 | } 35 | 36 | public static Module getModule(Item aIn) 37 | { 38 | return (Module) aIn.getAncestorOfCat(Module.MY_CAT); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/module/SubModuleItem.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.module; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Cat; 4 | import org.opendaylight.opflex.genie.engine.model.Item; 5 | 6 | /** 7 | * Created by dvorkinista on 7/6/14. 8 | */ 9 | public class SubModuleItem extends Item 10 | { 11 | protected SubModuleItem( 12 | Cat aInCat, 13 | Item aInParent, 14 | String aInLName 15 | ) 16 | { 17 | super(aInCat, aInParent, aInLName); 18 | } 19 | 20 | public Module getModule() 21 | { 22 | return Module.getModule(this); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mownership/DefinitionScope.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mownership; 2 | 3 | /** 4 | * Created by midvorki on 9/27/14. 5 | */ 6 | public enum DefinitionScope 7 | { 8 | GLOBAL, 9 | OWNER, 10 | MODULE, 11 | CLASS, 12 | GROUP, 13 | MEMBER, 14 | ; 15 | 16 | public static DefinitionScope get(String aIn) 17 | { 18 | for (DefinitionScope lScope : DefinitionScope.values()) 19 | { 20 | if (aIn.equalsIgnoreCase(lScope.toString())) 21 | { 22 | return lScope; 23 | } 24 | } 25 | return GLOBAL; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mownership/MModuleRule.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mownership; 2 | 3 | import java.util.LinkedList; 4 | 5 | import org.opendaylight.opflex.genie.engine.model.Cat; 6 | import org.opendaylight.opflex.genie.engine.model.Item; 7 | 8 | /** 9 | * Created by midvorki on 9/27/14. 10 | */ 11 | public class MModuleRule extends MOwnershipRule 12 | { 13 | public static final Cat MY_CAT = Cat.getCreate("mowner:module"); 14 | public MModuleRule(MOwner aInParent, String aInNameOrAll) 15 | { 16 | super(MY_CAT,aInParent,aInNameOrAll,DefinitionScope.OWNER); 17 | } 18 | 19 | public void initTargets() 20 | { 21 | LinkedList lIts = new LinkedList<>(); 22 | 23 | getChildItems(MClassRule.MY_CAT, lIts); 24 | for (Item lIt : lIts) 25 | { 26 | MClassRule lRule = (MClassRule) lIt; 27 | lRule.initTargets(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mownership/MOwned.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mownership; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Cat; 4 | import org.opendaylight.opflex.genie.engine.model.Item; 5 | 6 | /** 7 | * Created by midvorki on 9/27/14. 8 | */ 9 | public class MOwned extends Item 10 | { 11 | public static final Cat MY_CAT = Cat.getCreate("mowned"); 12 | 13 | public MOwned(Item aInParent, MOwner aInOwner, MClassRule aInRule) 14 | { 15 | super(MY_CAT,aInParent,aInRule.getGID().getName()); 16 | owner = aInOwner; 17 | rule = aInRule; 18 | } 19 | 20 | public MOwner getOwner() 21 | { 22 | return owner; 23 | } 24 | 25 | public MClassRule getRule() { return rule; } 26 | 27 | private final MOwner owner; 28 | private final MClassRule rule; 29 | } 30 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mownership/MOwnershipComponent.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mownership; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Cat; 4 | import org.opendaylight.opflex.genie.engine.model.Item; 5 | import org.opendaylight.opflex.modlan.utils.Strings; 6 | 7 | /** 8 | * Created by midvorki on 9/27/14. 9 | */ 10 | public class MOwnershipComponent extends Item 11 | { 12 | protected MOwnershipComponent(Cat aInCat, Item aInParent, String aInName, DefinitionScope aInDefScope) 13 | { 14 | super(aInCat,aInParent,aInName); 15 | definitionScope = aInDefScope; 16 | isWildCard = Strings.isEmpty(aInName) || Strings.isWildCard(aInName); 17 | } 18 | 19 | public DefinitionScope getDefinitionScope() 20 | { 21 | return definitionScope; 22 | } 23 | 24 | public boolean isWildCard() 25 | { 26 | return isWildCard; 27 | } 28 | 29 | private final DefinitionScope definitionScope; 30 | private final boolean isWildCard; 31 | } 32 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mownership/MOwnershipRule.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mownership; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Cat; 4 | 5 | /** 6 | * Created by midvorki on 9/27/14. 7 | */ 8 | public class MOwnershipRule extends MOwnershipComponent 9 | { 10 | protected MOwnershipRule(Cat aInCat, MOwnershipComponent aInParent, String aInName, DefinitionScope aInDefScope) 11 | { 12 | super(aInCat,aInParent,aInName, aInDefScope); 13 | } 14 | 15 | public MOwner getOwner() 16 | { 17 | return (MOwner) getAncestorOfCat(MOwner.MY_CAT); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mrelator/MRelatorRuleItem.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mrelator; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Cat; 4 | import org.opendaylight.opflex.genie.engine.model.RelatorCat; 5 | 6 | /** 7 | * Created by midvorki on 8/5/14. 8 | */ 9 | public class MRelatorRuleItem 10 | extends MRelatorItem 11 | { 12 | /** 13 | * Constructor 14 | * @param aInMyCat category of a containment item 15 | * @param aInParent parent item under which this item is created 16 | * @param aInTargetRelatorCat target class resolution category 17 | * @param aInTargetGname global name of the target class 18 | */ 19 | protected MRelatorRuleItem( 20 | Cat aInMyCat, MRelatorItem aInParent, RelatorCat aInTargetRelatorCat, String aInTargetGname) 21 | { 22 | super(aInMyCat, aInParent, aInTargetRelatorCat, aInTargetGname); 23 | } 24 | } -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mrelator/MSource.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mrelator; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Cardinality; 4 | import org.opendaylight.opflex.genie.engine.model.Cat; 5 | import org.opendaylight.opflex.genie.engine.model.RelatorCat; 6 | 7 | /** 8 | * Created by midvorki on 8/5/14. 9 | */ 10 | public class MSource extends MRelatorRuleItem 11 | { 12 | public static final Cat MY_CAT = Cat.getCreate("rel:source"); 13 | public static final RelatorCat TARGET_CAT = RelatorCat.getCreate("rel:source:target", Cardinality.SINGLE); 14 | 15 | public MSource( 16 | MRelated aInTarget, 17 | String aInChildGname) 18 | { 19 | super(MY_CAT, aInTarget, TARGET_CAT, aInChildGname); 20 | } 21 | } -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mrelator/MTarget.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mrelator; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Cardinality; 4 | import org.opendaylight.opflex.genie.engine.model.Cat; 5 | import org.opendaylight.opflex.genie.engine.model.RelatorCat; 6 | 7 | /** 8 | * Created by midvorki on 8/5/14. 9 | */ 10 | public class MTarget extends MRelatorRuleItem 11 | { 12 | public static final Cat MY_CAT = Cat.getCreate("rel:target"); 13 | public static final RelatorCat TARGET_CAT = RelatorCat.getCreate("rel:target:targetref", Cardinality.SINGLE); 14 | 15 | MTarget( 16 | MRelator aInSource, 17 | String aInTargetGname) 18 | { 19 | super(MY_CAT, aInSource, TARGET_CAT, aInTargetGname); 20 | } 21 | 22 | public MRelator getRelator() 23 | { 24 | return (MRelator) getParent(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mrelator/PointCardinality.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mrelator; 2 | 3 | import org.opendaylight.opflex.modlan.report.Severity; 4 | 5 | /** 6 | * Created by midvorki on 8/6/14. 7 | */ 8 | public enum PointCardinality 9 | { 10 | SINGLE, 11 | MANY, 12 | ; 13 | public static PointCardinality get(String aIn) 14 | { 15 | for (PointCardinality lThis : PointCardinality.values()) 16 | { 17 | if (lThis.toString().equalsIgnoreCase(aIn)) 18 | { 19 | return lThis; 20 | } 21 | } 22 | Severity.DEATH.report("relationship-cardinality", "get", "", "no cardinality: " + aIn); 23 | return SINGLE; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mtype/Language.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mtype; 2 | 3 | import org.opendaylight.opflex.modlan.report.Severity; 4 | 5 | /** 6 | * Created by dvorkinista on 7/7/14. 7 | */ 8 | public enum Language 9 | { 10 | C("c"), 11 | CPP("cpp"), 12 | JAVA("java") 13 | ; 14 | Language(String aIn) 15 | { 16 | name = aIn; 17 | } 18 | 19 | public String getName() 20 | { 21 | return name; 22 | } 23 | 24 | public String toString() 25 | { 26 | return name; 27 | } 28 | 29 | public static Language get(String aIn) 30 | { 31 | for (Language lLang : Language.values()) 32 | { 33 | if (aIn.equalsIgnoreCase(lLang.getName())) 34 | { 35 | return lLang; 36 | } 37 | } 38 | Severity.DEATH.report( 39 | "Language", "get language enum for name", "language not supported", "no support for " + aIn); 40 | 41 | return null; 42 | } 43 | private final String name; 44 | } 45 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mtype/MConstants.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mtype; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Cat; 4 | 5 | /** 6 | * Created by midvorki on 7/28/14. 7 | */ 8 | public class MConstants 9 | extends SubTypeItem 10 | { 11 | public static final Cat MY_CAT = Cat.getCreate("primitive:language:constants"); 12 | public static final String NAME = "constants"; 13 | public MConstants( 14 | MLanguageBinding aIn) 15 | { 16 | super(MY_CAT, aIn, NAME); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mtype/MTypeHint.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mtype; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Cat; 4 | 5 | /** 6 | * Created by dvorkinista on 7/7/14. 7 | */ 8 | public class MTypeHint 9 | extends SubTypeItem 10 | { 11 | public static final Cat MY_CAT = Cat.getCreate("type:hint"); 12 | public static final String NAME = "hint"; 13 | 14 | public MTypeHint( 15 | MType aInType, 16 | TypeInfo aInTypeInfo) 17 | { 18 | super(MY_CAT, aInType, NAME); 19 | info = aInTypeInfo; 20 | } 21 | 22 | public TypeInfo getInfo() 23 | { 24 | return info; 25 | } 26 | 27 | private final TypeInfo info; 28 | } 29 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mtype/PassBy.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mtype; 2 | 3 | import org.opendaylight.opflex.modlan.report.Severity; 4 | import org.opendaylight.opflex.modlan.utils.Strings; 5 | 6 | /** 7 | * Created by midvorki on 7/28/14. 8 | */ 9 | public enum PassBy 10 | { 11 | VALUE, 12 | REFERENCE, 13 | POINTER, 14 | UNKNOWN 15 | ; 16 | public static PassBy get(String aIn) 17 | { 18 | if (Strings.isEmpty(aIn)) 19 | { 20 | return UNKNOWN; 21 | } 22 | for (PassBy lThis : PassBy.values()) 23 | { 24 | if (lThis.toString().equalsIgnoreCase(aIn)) 25 | { 26 | return lThis; 27 | } 28 | } 29 | Severity.DEATH.report("type:pass-by", "retrieval of pass-by directve", "", "no such pass-by directive: " + aIn); 30 | return null; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mtype/SubTypeItem.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mtype; 2 | 3 | import org.opendaylight.opflex.genie.content.model.module.SubModuleItem; 4 | import org.opendaylight.opflex.genie.engine.model.Cat; 5 | 6 | /** 7 | * Created by dvorkinista on 7/7/14. 8 | */ 9 | public class SubTypeItem extends SubModuleItem 10 | { 11 | protected SubTypeItem(Cat aInCat,MType aInParent,String aInLName) 12 | { 13 | super(aInCat, aInParent, aInLName); 14 | } 15 | 16 | protected SubTypeItem(Cat aInCat,SubTypeItem aInParent,String aInLName) 17 | { 18 | super(aInCat, aInParent, aInLName); 19 | } 20 | 21 | public MType getMType() 22 | { 23 | return MType.getMType(this); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mvalidation/MConstraint.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mvalidation; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Cat; 4 | import org.opendaylight.opflex.genie.engine.model.Item; 5 | import org.opendaylight.opflex.modlan.report.Severity; 6 | 7 | /** 8 | * Created by midvorki on 7/10/14. 9 | */ 10 | public class MConstraint extends Item 11 | { 12 | protected MConstraint(Cat aInCat, MValidator aInValidator, String aInName) 13 | { 14 | super(aInCat, aInValidator, aInName); 15 | if (ValidatorAction.REMOVE == aInValidator.getAction()) 16 | { 17 | Severity.DEATH.report( 18 | this.toString(), 19 | "constraint definition", 20 | "constraint can't be defined", 21 | "constraint can only be defined under non-removed validators: " + aInValidator.getAction()); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mvalidation/MContentValidator.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mvalidation; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Cat; 4 | 5 | /** 6 | * Created by midvorki on 7/10/14. 7 | */ 8 | public class MContentValidator extends MConstraint 9 | { 10 | public static final Cat MY_CAT = Cat.getCreate("mvalidator:mcontent"); 11 | 12 | public MContentValidator(MValidator aInParent, String aInName) 13 | { 14 | super(MY_CAT, aInParent, aInName); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mvalidation/MContentValidatorParam.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mvalidation; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.*; 4 | 5 | /** 6 | * Created by midvorki on 7/10/14. 7 | */ 8 | public class MContentValidatorParam 9 | extends Item 10 | { 11 | public static final Cat MY_CAT = Cat.getCreate("mvalidator:mcontent:param"); 12 | public static final RelatorCat EXPLICIT_TYPE_REF = RelatorCat.getCreate( 13 | "mvalidator:mcontent:param:explicit-type-ref", Cardinality.SINGLE); 14 | 15 | public MContentValidatorParam( 16 | MContentValidator aInContentValidator, 17 | String aInName, 18 | String aInTypeGNameOrNull) 19 | { 20 | super(MY_CAT,aInContentValidator,aInName); 21 | if (!(null == aInTypeGNameOrNull || aInTypeGNameOrNull.isEmpty())) 22 | { 23 | EXPLICIT_TYPE_REF.add(MY_CAT, getGID().getName(), MY_CAT, aInTypeGNameOrNull); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/model/mvalidation/MRange.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.model.mvalidation; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Cat; 4 | 5 | /** 6 | * Created by midvorki on 7/10/14. 7 | */ 8 | public class MRange 9 | extends MConstraint 10 | { 11 | public static final Cat MY_CAT = Cat.getCreate("mvalidator:mrange"); 12 | 13 | public MRange(MValidator aInParent, String aInName) 14 | { 15 | super(MY_CAT, aInParent, aInName); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/parse/pdataowner/PGroupNode.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.parse.pdataowner; 2 | 3 | import org.opendaylight.opflex.genie.content.model.mownership.DefinitionScope; 4 | import org.opendaylight.opflex.genie.engine.model.Item; 5 | import org.opendaylight.opflex.genie.engine.model.Pair; 6 | import org.opendaylight.opflex.genie.engine.parse.model.ParseNode; 7 | import org.opendaylight.opflex.genie.engine.parse.model.ProcessorNode; 8 | import org.opendaylight.opflex.genie.engine.parse.modlan.Node; 9 | import org.opendaylight.opflex.genie.engine.parse.modlan.ParseDirective; 10 | 11 | /** 12 | * Created by midvorki on 9/27/14. 13 | */ 14 | public class PGroupNode extends ParseNode 15 | { 16 | public PGroupNode(String aInName) 17 | { 18 | super(aInName); 19 | } 20 | 21 | public Pair beginCB(Node aInData, Item aInParentItem) 22 | { 23 | return null; 24 | } 25 | 26 | protected void addParent(ProcessorNode aInParent) 27 | { 28 | super.addParent(aInParent); 29 | DefinitionScope scope = DefinitionScope.get(aInParent.getName()); 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/parse/pdataowner/PMemberNode.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.parse.pdataowner; 2 | 3 | import org.opendaylight.opflex.genie.content.model.mownership.DefinitionScope; 4 | import org.opendaylight.opflex.genie.engine.model.Item; 5 | import org.opendaylight.opflex.genie.engine.model.Pair; 6 | import org.opendaylight.opflex.genie.engine.parse.model.ParseNode; 7 | import org.opendaylight.opflex.genie.engine.parse.model.ProcessorNode; 8 | import org.opendaylight.opflex.genie.engine.parse.modlan.Node; 9 | import org.opendaylight.opflex.genie.engine.parse.modlan.ParseDirective; 10 | 11 | /** 12 | * Created by midvorki on 9/27/14. 13 | */ 14 | public class PMemberNode extends ParseNode 15 | { 16 | public PMemberNode(String aInName) 17 | { 18 | super(aInName); 19 | } 20 | 21 | public Pair beginCB(Node aInData, Item aInParentItem) 22 | { 23 | return null; 24 | } 25 | 26 | protected void addParent(ProcessorNode aInParent) 27 | { 28 | super.addParent(aInParent); 29 | scope = DefinitionScope.get(aInParent.getName()); 30 | } 31 | 32 | private DefinitionScope scope = null; 33 | } -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/parse/pformatter/PDomainNode.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.parse.pformatter; 2 | 3 | import org.opendaylight.opflex.genie.content.model.mformatter.MFormatterDomain; 4 | import org.opendaylight.opflex.genie.engine.model.Item; 5 | import org.opendaylight.opflex.genie.engine.model.Pair; 6 | import org.opendaylight.opflex.genie.engine.parse.model.ParseNode; 7 | import org.opendaylight.opflex.genie.engine.parse.modlan.Node; 8 | import org.opendaylight.opflex.genie.engine.parse.modlan.ParseDirective; 9 | import org.opendaylight.opflex.modlan.utils.Strings; 10 | 11 | /** 12 | * Created by midvorki on 7/24/14. 13 | */ 14 | public class PDomainNode extends ParseNode 15 | { 16 | public PDomainNode(String aInName) 17 | { 18 | super(aInName); 19 | } 20 | 21 | public Pair beginCB(Node aInData, Item aInParentItem) 22 | { 23 | MFormatterDomain lDom = new MFormatterDomain(aInData.getNamedValue(Strings.NAME,null, true)); 24 | return new Pair<>(ParseDirective.CONTINUE, lDom); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/parse/pformatter/PFeatureNode.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.parse.pformatter; 2 | 3 | import org.opendaylight.opflex.genie.content.model.mformatter.MFormatterDomain; 4 | import org.opendaylight.opflex.genie.content.model.mformatter.MFormatterFeature; 5 | import org.opendaylight.opflex.genie.engine.model.Item; 6 | import org.opendaylight.opflex.genie.engine.model.Pair; 7 | import org.opendaylight.opflex.genie.engine.parse.model.ParseNode; 8 | import org.opendaylight.opflex.genie.engine.parse.modlan.Node; 9 | import org.opendaylight.opflex.genie.engine.parse.modlan.ParseDirective; 10 | import org.opendaylight.opflex.modlan.utils.Strings; 11 | 12 | /** 13 | * Created by midvorki on 7/24/14. 14 | */ 15 | public class PFeatureNode extends ParseNode 16 | { 17 | public PFeatureNode(String aInName) 18 | { 19 | super(aInName); 20 | } 21 | 22 | public Pair beginCB(Node aInData, Item aInParentItem) 23 | { 24 | MFormatterFeature lF = new MFormatterFeature( 25 | (MFormatterDomain) aInParentItem, 26 | aInData.getNamedValue(Strings.NAME,null, true)); 27 | return new Pair<>(ParseDirective.CONTINUE, lF); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/parse/ploader/PDomainNode.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.parse.ploader; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Item; 4 | import org.opendaylight.opflex.genie.engine.model.Pair; 5 | import org.opendaylight.opflex.genie.engine.parse.model.ParseNode; 6 | import org.opendaylight.opflex.genie.engine.parse.modlan.Node; 7 | import org.opendaylight.opflex.genie.engine.parse.modlan.ParseDirective; 8 | 9 | /** 10 | * Created by midvorki on 7/25/14. 11 | */ 12 | public class PDomainNode extends ParseNode 13 | { 14 | public PDomainNode(String aInName) 15 | { 16 | super(aInName); 17 | } 18 | 19 | public Pair beginCB(Node aInData, Item aInParentItem) 20 | { 21 | // DO NOTHING 22 | return null; 23 | } 24 | } -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/parse/ploader/PFeatureNode.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.parse.ploader; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Item; 4 | import org.opendaylight.opflex.genie.engine.model.Pair; 5 | import org.opendaylight.opflex.genie.engine.parse.model.ParseNode; 6 | import org.opendaylight.opflex.genie.engine.parse.modlan.Node; 7 | import org.opendaylight.opflex.genie.engine.parse.modlan.ParseDirective; 8 | 9 | /** 10 | * Created by midvorki on 7/25/14. 11 | */ 12 | public class PFeatureNode extends ParseNode 13 | { 14 | public PFeatureNode(String aInName) 15 | { 16 | super(aInName); 17 | } 18 | 19 | public Pair beginCB(Node aInData, Item aInParentItem) 20 | { 21 | // DO NOTHING 22 | return null; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/parse/pmodule/PModuleNode.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.parse.pmodule; 2 | 3 | import org.opendaylight.opflex.genie.content.model.module.Module; 4 | import org.opendaylight.opflex.genie.engine.model.Item; 5 | import org.opendaylight.opflex.genie.engine.model.Pair; 6 | import org.opendaylight.opflex.genie.engine.parse.model.ParseNode; 7 | import org.opendaylight.opflex.genie.engine.parse.modlan.Node; 8 | import org.opendaylight.opflex.genie.engine.parse.modlan.ParseDirective; 9 | 10 | /** 11 | * Created by midvorki on 7/21/14. 12 | */ 13 | public class PModuleNode 14 | extends ParseNode 15 | { 16 | /** 17 | * Constructor 18 | */ 19 | public PModuleNode(String aInName) 20 | { 21 | super(aInName); 22 | } 23 | 24 | public Pair beginCB(Node aInData, Item aInParentItem) 25 | { 26 | return new Pair<>( 27 | ParseDirective.CONTINUE, 28 | Module.get(aInData.getNamedValue("name", null, true), true)); 29 | } 30 | } -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/parse/pnaming/PParentNode.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.parse.pnaming; 2 | 3 | import org.opendaylight.opflex.genie.content.model.mnaming.MNamer; 4 | import org.opendaylight.opflex.genie.engine.model.Item; 5 | import org.opendaylight.opflex.genie.engine.model.Pair; 6 | import org.opendaylight.opflex.genie.engine.parse.model.ParseNode; 7 | import org.opendaylight.opflex.genie.engine.parse.modlan.Node; 8 | import org.opendaylight.opflex.genie.engine.parse.modlan.ParseDirective; 9 | import org.opendaylight.opflex.modlan.utils.Strings; 10 | 11 | /** 12 | * Created by midvorki on 8/1/14. 13 | */ 14 | public class PParentNode extends ParseNode 15 | { 16 | public PParentNode(String aInName) 17 | { 18 | super(aInName); 19 | } 20 | 21 | public Pair beginCB(Node aInData, Item aInParentItem) 22 | { 23 | return new Pair<>( 24 | ParseDirective.CONTINUE, 25 | ((MNamer) aInParentItem).getNameRule( 26 | aInData.getNamedValue( 27 | Strings.CLASS, 28 | aInData.getNamedValue(Strings.NAME, null, false), 29 | true), 30 | true)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/parse/ptype/PConstantsNode.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.parse.ptype; 2 | 3 | import org.opendaylight.opflex.genie.content.model.mtype.MConstants; 4 | import org.opendaylight.opflex.genie.content.model.mtype.MLanguageBinding; 5 | import org.opendaylight.opflex.genie.engine.model.Item; 6 | import org.opendaylight.opflex.genie.engine.model.Pair; 7 | import org.opendaylight.opflex.genie.engine.parse.model.ParseNode; 8 | import org.opendaylight.opflex.genie.engine.parse.modlan.Node; 9 | import org.opendaylight.opflex.genie.engine.parse.modlan.ParseDirective; 10 | 11 | /** 12 | * Created by midvorki on 7/28/14. 13 | */ 14 | public class PConstantsNode 15 | extends ParseNode 16 | { 17 | /** 18 | * Constructor 19 | */ 20 | public PConstantsNode(String aInName) 21 | { 22 | super(aInName); 23 | } 24 | 25 | public Pair beginCB(Node aInData, Item aInParentItem) 26 | { 27 | return new Pair<>( 28 | ParseDirective.CONTINUE, 29 | new MConstants((MLanguageBinding) aInParentItem 30 | )); 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/parse/ptype/PConstraintsNode.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.parse.ptype; 2 | 3 | import org.opendaylight.opflex.genie.content.model.mtype.MConstraints; 4 | import org.opendaylight.opflex.genie.content.model.mtype.MLanguageBinding; 5 | import org.opendaylight.opflex.genie.engine.model.Item; 6 | import org.opendaylight.opflex.genie.engine.model.Pair; 7 | import org.opendaylight.opflex.genie.engine.parse.model.ParseNode; 8 | import org.opendaylight.opflex.genie.engine.parse.modlan.Node; 9 | import org.opendaylight.opflex.genie.engine.parse.modlan.ParseDirective; 10 | 11 | /** 12 | * Created by midvorki on 7/28/14. 13 | */ 14 | public class PConstraintsNode 15 | extends ParseNode 16 | { 17 | /** 18 | * Constructor 19 | */ 20 | public PConstraintsNode(String aInName) 21 | { 22 | super(aInName); 23 | } 24 | 25 | public Pair beginCB(Node aInData, Item aInParentItem) 26 | { 27 | return new Pair<>( 28 | ParseDirective.CONTINUE, 29 | new MConstraints((MLanguageBinding) aInParentItem, 30 | aInData.getNamedValue("use-type", null, false) 31 | )); 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/parse/ptype/PHintNode.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.parse.ptype; 2 | 3 | import org.opendaylight.opflex.genie.content.model.mtype.MType; 4 | import org.opendaylight.opflex.genie.content.model.mtype.MTypeHint; 5 | import org.opendaylight.opflex.genie.content.model.mtype.TypeInfo; 6 | import org.opendaylight.opflex.genie.engine.model.Item; 7 | import org.opendaylight.opflex.genie.engine.model.Pair; 8 | import org.opendaylight.opflex.genie.engine.parse.model.ParseNode; 9 | import org.opendaylight.opflex.genie.engine.parse.modlan.Node; 10 | import org.opendaylight.opflex.genie.engine.parse.modlan.ParseDirective; 11 | import org.opendaylight.opflex.modlan.utils.Strings; 12 | 13 | /** 14 | * Created by midvorki on 7/21/14. 15 | */ 16 | public class PHintNode 17 | extends ParseNode 18 | { 19 | /** 20 | * Constructor 21 | */ 22 | public PHintNode(String aInName) 23 | { 24 | super(aInName); 25 | } 26 | 27 | public Pair beginCB(Node aInData, Item aInParentItem) 28 | { 29 | MTypeHint lHint = new MTypeHint((MType)aInParentItem, TypeInfo.get(aInData.getNamedValue(Strings.NAME,null,true))); 30 | return new Pair<>(ParseDirective.CONTINUE, lHint); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/content/parse/pvalidation/PRangeNode.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.content.parse.pvalidation; 2 | 3 | import org.opendaylight.opflex.genie.content.model.mvalidation.*; 4 | import org.opendaylight.opflex.genie.engine.model.Item; 5 | import org.opendaylight.opflex.genie.engine.model.Pair; 6 | import org.opendaylight.opflex.genie.engine.parse.model.ParseNode; 7 | import org.opendaylight.opflex.genie.engine.parse.modlan.Node; 8 | import org.opendaylight.opflex.genie.engine.parse.modlan.ParseDirective; 9 | import org.opendaylight.opflex.modlan.utils.Strings; 10 | 11 | /** 12 | * Created by midvorki on 7/22/14. 13 | */ 14 | public class PRangeNode 15 | extends ParseNode 16 | { 17 | public PRangeNode(String aInName) 18 | { 19 | super(aInName); 20 | ValidatorAction action = ValidatorAction.get(aInName); 21 | } 22 | 23 | public Pair beginCB(Node aInData, Item aInParentItem) 24 | { 25 | MRange lRange = new MRange( 26 | (MValidator)aInParentItem, 27 | aInData.getNamedValue(Strings.NAME,Strings.DEFAULT,true)); 28 | 29 | return new Pair<>(ParseDirective.CONTINUE,lRange); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/format/FormatterCtx.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.format; 2 | 3 | /** 4 | * Created by midvorki on 7/24/14. 5 | */ 6 | public class FormatterCtx 7 | { 8 | public FormatterCtx(String aInDomain, String aInDestDir) 9 | { 10 | domain = aInDomain; 11 | rootPath = aInDestDir; 12 | } 13 | 14 | public String getRootPath() 15 | { 16 | return rootPath; 17 | } 18 | public String getDomain() { return domain; } 19 | 20 | public String toString() 21 | { 22 | return "formatter-ctx(" + getRootPath() + ')'; 23 | } 24 | 25 | private final String domain; 26 | private final String rootPath; 27 | } 28 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/format/FormatterTaskType.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.format; 2 | 3 | import org.opendaylight.opflex.modlan.report.Severity; 4 | 5 | /** 6 | * Created by midvorki on 7/24/14. 7 | */ 8 | public enum FormatterTaskType 9 | { 10 | GENERIC("generic"), 11 | CATEGORY("category"), 12 | ITEM("item"), 13 | ; 14 | private FormatterTaskType(String aInName) 15 | { 16 | name = aInName; 17 | } 18 | public static FormatterTaskType get(String aIn) 19 | { 20 | for (FormatterTaskType lThis : FormatterTaskType.values()) 21 | { 22 | if (lThis.name.equalsIgnoreCase(aIn)) 23 | { 24 | return lThis; 25 | } 26 | } 27 | Severity.DEATH.report( 28 | "FormatterTaskType", 29 | "get formatter task type for name", 30 | "no such formatter task type", 31 | "no support for " + aIn); 32 | return null; 33 | } 34 | private final String name; 35 | } 36 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/format/GenericFormatterTask.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.format; 2 | 3 | /** 4 | * Created by midvorki on 7/25/14. 5 | */ 6 | public abstract class GenericFormatterTask extends FormatterTask 7 | { 8 | protected GenericFormatterTask(FormatterCtx aInFormatterCtx, 9 | FileNameRule aInFileNameRule, 10 | Indenter aInIndenter, 11 | BlockFormatDirective aInHeaderFormatDirective, 12 | BlockFormatDirective aInCommentFormatDirective, 13 | boolean aInIsUserFile) 14 | { 15 | super(aInFormatterCtx, 16 | aInFileNameRule, 17 | aInIndenter, 18 | aInHeaderFormatDirective, 19 | aInCommentFormatDirective, 20 | aInIsUserFile 21 | ); 22 | } 23 | 24 | public void generate() 25 | { 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/format/HeaderLine.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.format; 2 | 3 | import java.util.Set; 4 | import java.util.TreeSet; 5 | 6 | /** 7 | * Created by midvorki on 11/5/14. 8 | */ 9 | public class HeaderLine 10 | { 11 | public HeaderLine(String aIn) 12 | { 13 | line = aIn; 14 | 15 | for (HeaderOption lOpt : HeaderOption.values()) 16 | { 17 | if (line.contains(lOpt.getName())) 18 | { 19 | options.add(lOpt); 20 | } 21 | } 22 | } 23 | 24 | public String getLine() 25 | { 26 | return line; 27 | } 28 | 29 | public boolean hasOption(HeaderOption aIn) 30 | { 31 | return options.contains(aIn); 32 | } 33 | 34 | private final String line; 35 | private final Set options = new TreeSet<>(); 36 | } 37 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/format/HeaderOption.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.format; 2 | 3 | /** 4 | * Created by midvorki on 11/5/14. 5 | */ 6 | public enum HeaderOption 7 | { 8 | GENIE_VAR_FULL_FILE_NAME("GENIE_VAR_FULL_FILE_NAME"), 9 | ; 10 | private HeaderOption(String aInName) 11 | { 12 | name = aInName; 13 | } 14 | 15 | public String getName() { return name; } 16 | 17 | private final String name; 18 | } 19 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/format/ItemFormatterTask.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.format; 2 | 3 | import org.opendaylight.opflex.genie.engine.model.Item; 4 | 5 | /** 6 | * Created by midvorki on 7/24/14. 7 | */ 8 | public abstract class ItemFormatterTask extends FormatterTask 9 | { 10 | protected ItemFormatterTask( 11 | FormatterCtx aInFormatterCtx, 12 | FileNameRule aInFileNameRule, 13 | Indenter aInIndenter, 14 | BlockFormatDirective aInHeaderFormatDirective, 15 | BlockFormatDirective aInCommentFormatDirective, 16 | boolean aInIsUserFile, 17 | Item aInItem) 18 | { 19 | super(aInFormatterCtx, 20 | aInFileNameRule, 21 | aInIndenter, 22 | aInHeaderFormatDirective, 23 | aInCommentFormatDirective, 24 | aInIsUserFile 25 | ); 26 | 27 | item = aInItem; 28 | } 29 | 30 | public Item getItem() 31 | { 32 | return item; 33 | } 34 | 35 | private final Item item; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/model/Cardinality.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.model; 2 | 3 | /** 4 | * Created by midvorki on 3/27/14. 5 | */ 6 | public enum Cardinality 7 | { 8 | SINGLE, 9 | MULTI, 10 | ; 11 | } 12 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/model/Pair.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.model; 2 | 3 | /** 4 | * Created by midvorki on 7/8/14. 5 | */ 6 | public class Pair 7 | { 8 | private final F first; 9 | private final S second; 10 | 11 | public Pair(F aInFirst, S aInSecond) 12 | { 13 | this.first = aInFirst; 14 | this.second = aInSecond; 15 | } 16 | 17 | public F getFirst() 18 | { 19 | return first; 20 | } 21 | 22 | public S getSecond() 23 | { 24 | return second; 25 | } 26 | 27 | public String toString() 28 | { 29 | return "PAIR[" + first +"," + second + "]"; 30 | } 31 | } -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/parse/load/LoadStage.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.parse.load; 2 | 3 | /** 4 | * Created by midvorki on 7/25/14. 5 | */ 6 | public enum LoadStage 7 | { 8 | PRE(false), 9 | LOAD(true), 10 | POST(true) 11 | ; 12 | private LoadStage(boolean aInIsParallel) 13 | { 14 | isParallel = aInIsParallel; 15 | } 16 | 17 | public static LoadStage get(String aInName) 18 | { 19 | for (LoadStage lThis : LoadStage.values()) 20 | { 21 | if (lThis.toString().equalsIgnoreCase(aInName)) 22 | { 23 | return lThis; 24 | } 25 | } 26 | return LOAD; 27 | } 28 | 29 | public boolean isParallel() 30 | { 31 | return isParallel; 32 | } 33 | 34 | private final boolean isParallel; 35 | } 36 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/parse/load/LoaderRegistry.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.parse.load; 2 | 3 | import java.util.TreeMap; 4 | 5 | /** 6 | * Created by midvorki on 7/25/14. 7 | */ 8 | public class LoaderRegistry 9 | { 10 | public static LoaderRegistry get() 11 | { 12 | return inst; 13 | } 14 | 15 | public LoaderDomainMeta getDomain(String aInName, boolean aInCreateIfNotFound) 16 | { 17 | LoaderDomainMeta lDom = domains.get(aInName); 18 | if (null == lDom && aInCreateIfNotFound) 19 | { 20 | lDom = new LoaderDomainMeta(aInName); 21 | domains.put(aInName,lDom); 22 | } 23 | return lDom; 24 | } 25 | 26 | public void process(LoadStage aInStage) 27 | { 28 | for (LoaderDomainMeta lThis : domains.values()) 29 | { 30 | lThis.process(aInStage); 31 | } 32 | } 33 | 34 | public String toString() 35 | { 36 | return "loader:registry"; 37 | } 38 | private final TreeMap domains = new TreeMap<>(); 39 | private static final LoaderRegistry inst = new LoaderRegistry(); 40 | } 41 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/parse/model/ParseNodeProp.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.parse.model; 2 | 3 | /** 4 | * Created by midvorki on 7/22/14. 5 | */ 6 | public class ParseNodeProp 7 | { 8 | public ParseNodeProp( 9 | String aInName, 10 | ParseNodePropType aInType, 11 | boolean aInIsMandatory) 12 | { 13 | name = aInName; 14 | type = aInType; 15 | isMandatory = aInIsMandatory; 16 | } 17 | 18 | public String getName() 19 | { 20 | return name; 21 | } 22 | 23 | public ParseNodePropType getType() 24 | { 25 | return type; 26 | } 27 | 28 | public boolean isMandatory() 29 | { 30 | return isMandatory; 31 | } 32 | 33 | public String toString() 34 | { 35 | return type + "<" + name + "|" + (isMandatory ? "mandatory" : "optional") + ">"; 36 | } 37 | 38 | private final String name; 39 | private final ParseNodePropType type; 40 | private final boolean isMandatory; 41 | } 42 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/parse/modlan/ParseDirective.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.parse.modlan; 2 | 3 | /** 4 | * Created by midvorki on 3/22/14. 5 | */ 6 | public enum ParseDirective 7 | { 8 | CONTINUE, 9 | END_SUBTREE, 10 | END_TREE 11 | ; 12 | } 13 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/parse/modlan/Processor.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.parse.modlan; 2 | 3 | import java.util.Collection; 4 | 5 | import org.opendaylight.opflex.genie.engine.model.Item; 6 | import org.opendaylight.opflex.genie.engine.model.Pair; 7 | 8 | /** 9 | * Created by midvorki on 3/22/14. 10 | */ 11 | public interface Processor 12 | { 13 | Pair beginCB(Node aInData, Item aInParentItemOrNull); 14 | void endCB(Node aInData, Item aInItemOrNull); 15 | Processor getChild(String aInName); 16 | boolean hasProp(String aInName); 17 | Collection getPropNames(); 18 | } 19 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/parse/modlan/ProcessorRegistry.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.parse.modlan; 2 | 3 | /** 4 | * Created by midvorki on 3/22/14. 5 | */ 6 | public interface ProcessorRegistry 7 | { 8 | Processor getRoot(); 9 | } 10 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/proc/Doer.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.proc; 2 | 3 | import org.opendaylight.opflex.modlan.report.Severity; 4 | 5 | /** 6 | * Created by midvorki on 3/26/14. 7 | */ 8 | public class Doer extends Thread 9 | { 10 | public Doer(int aInId, Chnl aInChnl) 11 | { 12 | super("doer(" + aInId + ")"); 13 | chnl = aInChnl; 14 | } 15 | 16 | public void run() 17 | { 18 | while (!chnl.isDeath()) 19 | { 20 | Task lTask = chnl.poll(); 21 | if (null != lTask) 22 | { 23 | try 24 | { 25 | lTask.run(); 26 | } 27 | catch(Throwable lT) 28 | { 29 | Severity.DEATH.report(toString(),"run","exception eoncountered",lT); 30 | } 31 | finally 32 | { 33 | chnl.doneCb(); 34 | } 35 | } 36 | } 37 | Severity.INFO.report(toString(), "run", "task", "DEATH."); 38 | } 39 | 40 | public String toString() 41 | { 42 | return getName(); 43 | } 44 | 45 | private final Chnl chnl; 46 | } 47 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/proc/Dsptchr.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.proc; 2 | 3 | /** 4 | * Created by midvorki on 3/26/14. 5 | */ 6 | public class Dsptchr 7 | { 8 | public Dsptchr() 9 | { 10 | Doer lThis = new Doer(1, chnl); 11 | lThis.start(); 12 | } 13 | 14 | public void trigger(Task aInTask) 15 | { 16 | chnl.put(aInTask); 17 | } 18 | 19 | public void drain() 20 | { 21 | chnl.suspendUntilDrained(); 22 | } 23 | 24 | public void kill() 25 | { 26 | chnl.markForDeath(); 27 | } 28 | 29 | private final Chnl chnl = new Chnl(); 30 | } 31 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/proc/SearchPath.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.proc; 2 | 3 | /** 4 | * Created by midvorki on 10/22/14. 5 | */ 6 | public class SearchPath 7 | { 8 | public SearchPath(String aInPath, String aInSuffix) 9 | { 10 | path = aInPath; 11 | suffix = aInSuffix; 12 | } 13 | 14 | public String getPath() 15 | { 16 | return path; 17 | } 18 | 19 | public String getSuffix() 20 | { 21 | return suffix; 22 | } 23 | 24 | public String toString() 25 | { 26 | return "search-path(path=" + path + ", suffix=" + suffix + ")"; 27 | } 28 | private final String path; 29 | private final String suffix; 30 | } 31 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/proc/Status.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.proc; 2 | 3 | /** 4 | * Created by midvorki on 3/26/14. 5 | */ 6 | public enum Status 7 | { 8 | RUNNING, 9 | SUSPEND, 10 | DEATH, 11 | } 12 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/genie/engine/proc/Task.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.genie.engine.proc; 2 | 3 | /** 4 | * Created by midvorki on 3/26/14. 5 | */ 6 | public interface Task extends Runnable 7 | { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/modlan/parse/Attach.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.modlan.parse; 2 | 3 | /** 4 | * Created by midvorki on 3/10/14. 5 | */ 6 | 7 | public enum Attach 8 | { 9 | CONTAINING, 10 | FOLLOWING, 11 | PRECEDING 12 | ; 13 | } -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/modlan/parse/Consumer.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.modlan.parse; 2 | 3 | /** 4 | * Created by midvorki on 3/10/14. 5 | */ 6 | public interface Consumer 7 | { 8 | Data onDocBegin(String aInName); 9 | Data onDocEnd(String aInName); 10 | 11 | Data onNodeBegin(String aInName); 12 | Data onNodeEnd(String aInName); 13 | 14 | Data onQual(String aIn); 15 | Data onComment(String aInLine); 16 | Data onText(String aInLine); 17 | Data onValue(String aInValue); 18 | 19 | Data onContentBegin(String aInName); 20 | Data onContentEnd(String aInName); 21 | 22 | void setEngine(Engine aIn); 23 | } 24 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/modlan/parse/Ctx.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.modlan.parse; 2 | 3 | /** 4 | * Created by midvorki on 3/10/14. 5 | */ 6 | public interface Ctx 7 | { 8 | boolean hasMore(); 9 | 10 | char getThis(); 11 | 12 | char getNext(); 13 | 14 | void holdThisForNext(); 15 | 16 | String getFileName(); 17 | 18 | int getCurrLineNum(); 19 | int getCurrColumnNum(); 20 | int getCurrCharNum(); 21 | } 22 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/modlan/parse/Data.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.modlan.parse; 2 | 3 | /** 4 | * Created by midvorki on 3/18/14. 5 | */ 6 | public interface Data 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/modlan/parse/Incl.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.modlan.parse; 2 | 3 | /** 4 | * Created by midvorki on 3/10/14. 5 | */ 6 | public enum Incl 7 | { 8 | SKIP, 9 | ALLOW, 10 | DISALLOW 11 | } 12 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/modlan/parse/LitBuff.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.modlan.parse; 2 | 3 | /** 4 | * Created by midvorki on 3/16/14. 5 | */ 6 | public class LitBuff 7 | { 8 | public LitBuff() 9 | { 10 | reset(); 11 | } 12 | 13 | public void append(char aIn) 14 | { 15 | sb.append(aIn); 16 | } 17 | 18 | public void reset() 19 | { 20 | if (null == sb || 0 < sb.length()) 21 | { 22 | sb = new StringBuilder(); //new StringBuffer(); 23 | } 24 | } 25 | 26 | public int getSize() 27 | { 28 | return null == sb ? 0 : sb.length(); 29 | } 30 | 31 | public String toString() 32 | { 33 | return sb.toString(); 34 | } 35 | 36 | private StringBuilder sb = null; 37 | } 38 | -------------------------------------------------------------------------------- /genie/src/main/java/org/opendaylight/opflex/modlan/parse/Req.java: -------------------------------------------------------------------------------- 1 | package org.opendaylight.opflex.modlan.parse; 2 | 3 | /** 4 | * Created by midvorki on 3/10/14. 5 | */ 6 | public enum Req 7 | { 8 | NONE, 9 | OPTIONAL, 10 | MANDATORY 11 | ; 12 | } 13 | -------------------------------------------------------------------------------- /libopflex-metadata/.gitignore: -------------------------------------------------------------------------------- 1 | /target -------------------------------------------------------------------------------- /libopflex-metadata/src/main/java/org/opendaylight/opflex/modb/ConstInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | package org.opendaylight.opflex.modb; 9 | 10 | public class ConstInfo { 11 | 12 | private final String name; 13 | private final int value; 14 | 15 | public ConstInfo(String name, int value) { 16 | this.name = name; 17 | this.value = value; 18 | } 19 | 20 | public String getName() { 21 | return name; 22 | } 23 | 24 | public int getValue() { 25 | return value; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libopflex-metadata/src/main/java/org/opendaylight/opflex/modb/EnumInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | package org.opendaylight.opflex.modb; 9 | 10 | import java.util.Arrays; 11 | import java.util.List; 12 | 13 | public class EnumInfo { 14 | 15 | private final String name; 16 | private final List consts; 17 | 18 | public EnumInfo(String name, ConstInfo ... consts) { 19 | this.name = name; 20 | this.consts = Arrays.asList(consts); 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public List getConsts() { 28 | return consts; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /libopflex-metadata/src/main/java/org/opendaylight/opflex/modb/MAC.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | package org.opendaylight.opflex.modb; 9 | 10 | public class MAC { 11 | 12 | private final String mac; 13 | 14 | public MAC(String mac) { 15 | this.mac = mac; 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | return mac; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /libopflex-metadata/src/main/java/org/opendaylight/opflex/modb/URI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | package org.opendaylight.opflex.modb; 9 | 10 | public class URI { 11 | 12 | public static final URI ROOT = new URI("/"); 13 | 14 | private final String uri; 15 | 16 | public URI(String uri) { 17 | this.uri = uri; 18 | } 19 | 20 | @Override 21 | public boolean equals(Object obj) { 22 | if (this == obj) { 23 | return true; 24 | } 25 | if (obj == null || getClass() != obj.getClass()) { 26 | return false; 27 | } 28 | return uri.equals(((URI) obj).uri); 29 | } 30 | 31 | @Override 32 | public int hashCode() { 33 | return uri.hashCode(); 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return uri; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /libopflex/.gitignore: -------------------------------------------------------------------------------- 1 | build* 2 | Makefile 3 | Makefile.in 4 | core 5 | .deps 6 | .libs 7 | *.o 8 | *.lo 9 | *.la 10 | *_test 11 | install-sh 12 | libtool 13 | ltmain.sh 14 | missing 15 | cscope* 16 | config.guess 17 | autom4te.cache 18 | aclocal.m4 19 | config.h 20 | config.h.in 21 | config.log 22 | config.status 23 | config.sub 24 | configure 25 | depcomp 26 | *~ 27 | errors.err 28 | :q 29 | q 30 | :qa 31 | qa 32 | :wqa 33 | wqa 34 | stamp-h1 35 | libopflex.pc 36 | compile 37 | test-driver 38 | *.log 39 | *.trs 40 | m4/libtool.m4 41 | m4/lt*.m4 42 | .cproject 43 | .project 44 | .settings 45 | .tags 46 | .tags_sorted_by_file 47 | .dirstamp 48 | *.rpm 49 | *.spec 50 | *.tar.gz 51 | -------------------------------------------------------------------------------- /libopflex/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # libopflex: a framework for developing opflex-based policy agents 4 | # Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 5 | # 6 | # This program and the accompanying materials are made available under the 7 | # terms of the Eclipse Public License v1.0 which accompanies this distribution, 8 | # and is available at http://www.eclipse.org/legal/epl-v10.html 9 | 10 | # This autogen script will run the autotools to generate the build 11 | # system. You should run this script in order to initialize a build 12 | # immediately following a checkout. 13 | 14 | for i in m4/* 15 | do 16 | if [ -L "${i}" ] 17 | then 18 | rm "${i}" 19 | fi 20 | done 21 | 22 | autoreconf -fis 23 | -------------------------------------------------------------------------------- /libopflex/comms/ActivePeer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | #include 18 | 19 | namespace yajr { 20 | namespace comms { 21 | namespace internal { 22 | 23 | void ActivePeer::destroy(bool now) { 24 | 25 | VLOG(6) 26 | << this 27 | ; 28 | 29 | bool alreadyBeingDestroyed = destroying_; 30 | 31 | if (!alreadyBeingDestroyed || now) { 32 | CommunicationPeer::destroy(now); 33 | } 34 | 35 | if (alreadyBeingDestroyed) { 36 | VLOG(1) 37 | << this 38 | << " multiple destroy()s detected" 39 | ; 40 | return; 41 | } 42 | 43 | VLOG(5) 44 | << this 45 | << " down() for destruction" 46 | ; 47 | down(); 48 | } 49 | 50 | } // namespace internal 51 | } // namespace comms 52 | } // namespace yajr 53 | 54 | -------------------------------------------------------------------------------- /libopflex/comms/ListeningPeer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | #include 18 | 19 | namespace yajr { 20 | namespace comms { 21 | namespace internal { 22 | 23 | void ListeningPeer::destroy(bool now) { 24 | 25 | assert(!destroying_); 26 | if (destroying_) { 27 | LOG(WARNING) 28 | << this 29 | << " Double destroy() detected" 30 | ; 31 | 32 | return; 33 | } 34 | 35 | destroying_ = 1; 36 | 37 | if (down()) { 38 | return; 39 | } 40 | 41 | if (connected_) { 42 | connected_ = 0; 43 | if (!uv_is_closing(getHandle())) { 44 | uv_close(getHandle(), on_close); 45 | } 46 | } 47 | } 48 | 49 | } // namespace internal 50 | } // namespace comms 51 | } // namespace yajr 52 | 53 | -------------------------------------------------------------------------------- /libopflex/comms/include/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # libopflex: a framework for developing opflex-based policy agents 3 | # Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 4 | # 5 | # This program and the accompanying materials are made available under the 6 | # terms of the Eclipse Public License v1.0 which accompanies this distribution, 7 | # and is available at http://www.eclipse.org/legal/epl-v10.html 8 | # 9 | ########### 10 | # 11 | # Install the yajr headers 12 | 13 | comms_headers = 14 | comms_headers += yajr/rpc/internal/fnv_1a_64.hpp 15 | comms_headers += yajr/rpc/internal/json_stream_wrappers.hpp 16 | comms_headers += yajr/rpc/method_lookup.hpp 17 | comms_headers += yajr/rpc/methods.hpp 18 | comms_headers += yajr/rpc/gen/echo.hpp 19 | comms_headers += yajr/transport/ZeroCopyOpenSSL.hpp 20 | 21 | EXTRA_DIST = $(comms_headers) 22 | 23 | uninstall-local: 24 | @$(NORMAL_UNINSTALL) 25 | rm -rf "${DESTDIR}/${includedir}/yajr" 26 | -------------------------------------------------------------------------------- /libopflex/comms/include/yajr/rpc/gen/echo.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | #pragma once 10 | #ifndef _________COMMS__INCLUDE__YAJR__RPC__GEN__ECHO_HPP 11 | #define _________COMMS__INCLUDE__YAJR__RPC__GEN__ECHO_HPP 12 | 13 | #include 14 | 15 | namespace yajr { 16 | namespace comms { 17 | namespace internal { 18 | 19 | class EchoGen { 20 | public: 21 | explicit EchoGen(CommunicationPeer const & peer) : peer_(peer) {} 22 | 23 | bool operator()(rpc::SendHandler & handler); 24 | 25 | private: 26 | CommunicationPeer const & peer_; 27 | }; 28 | 29 | } // namespace internal 30 | } // namespace comms 31 | } // namespace yajr 32 | 33 | #endif /* _________COMMS__INCLUDE__YAJR__RPC__GEN__ECHO_HPP */ 34 | -------------------------------------------------------------------------------- /libopflex/comms/rpc/handlers/error_response/echo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbErr<&yajr::rpc::method::echo>::process() const { 22 | 23 | LOG(ERROR); 24 | 25 | } 26 | 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/rpc/handlers/error_response/unknown.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbErr<&yajr::rpc::method::unknown>::process() const { 22 | 23 | } 24 | 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /libopflex/comms/rpc/handlers/request/echo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbReq<&yajr::rpc::method::echo>::process() const { 22 | OutboundResult ( 23 | this, 24 | GeneratorFromValue(getPayload()) /* payload from inbound req */ 25 | ) 26 | . send(); 27 | } 28 | 29 | } /* yajr::rpc namespace */ 30 | } /* yajr namespace */ 31 | 32 | -------------------------------------------------------------------------------- /libopflex/comms/rpc/handlers/request/unknown.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbReq<&yajr::rpc::method::unknown>::process() const { 22 | 23 | } 24 | 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /libopflex/comms/rpc/handlers/result_response/echo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | #include 17 | 18 | namespace yajr { 19 | namespace rpc { 20 | 21 | template<> 22 | void InbRes<&yajr::rpc::method::echo>::process() const { 23 | 24 | VLOG(6) 25 | << "Got echo reply at " 26 | << getReceived() 27 | ; 28 | 29 | } 30 | 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /libopflex/comms/rpc/handlers/result_response/unknown.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { namespace rpc { 18 | 19 | template<> 20 | void InbRes<&yajr::rpc::method::unknown>::process() const { 21 | 22 | } 23 | 24 | }} 25 | -------------------------------------------------------------------------------- /libopflex/comms/rpc/message/factory/inbounderror.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | namespace fnv_1a_64 = yajr::rpc::internal::fnv_1a_64; 20 | 21 | namespace yajr { 22 | namespace rpc { 23 | 24 | yajr::rpc::InboundError * 25 | MessageFactory::InboundError( 26 | yajr::Peer& peer, 27 | rapidjson::Value const & error, 28 | rapidjson::Value const & id) { 29 | 30 | char const * method = id[rapidjson::SizeType(0)].GetString(); 31 | 32 | #undef PERFECT_RET_VAL 33 | #define PERFECT_RET_VAL(method) \ 34 | new (std::nothrow) InbErr<&method>(peer, error, id) 35 | #include 36 | } 37 | 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /libopflex/comms/rpc/message/factory/inboundrequest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | namespace fnv_1a_64 = yajr::rpc::internal::fnv_1a_64; 20 | 21 | namespace yajr { 22 | namespace rpc { 23 | 24 | yajr::rpc::InboundRequest * 25 | MessageFactory::InboundRequest( 26 | yajr::Peer& peer, 27 | rapidjson::Value const & params, 28 | char const * method, 29 | rapidjson::Value const & id) { 30 | #undef PERFECT_RET_VAL 31 | #define PERFECT_RET_VAL(method) \ 32 | new (std::nothrow) InbReq<&method>(peer, params, id) 33 | #include 34 | } 35 | 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /libopflex/comms/rpc/message/factory/inboundresult.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | namespace fnv_1a_64 = yajr::rpc::internal::fnv_1a_64; 20 | 21 | namespace yajr { 22 | namespace rpc { 23 | 24 | yajr::rpc::InboundResult * 25 | MessageFactory::InboundResult( 26 | yajr::Peer& peer, 27 | rapidjson::Value const & result, 28 | rapidjson::Value const & id) { 29 | 30 | char const * method = id[rapidjson::SizeType(0)].GetString(); 31 | 32 | #undef PERFECT_RET_VAL 33 | #define PERFECT_RET_VAL(method) \ 34 | new (std::nothrow) InbRes<&method>(peer, result, id) 35 | #include 36 | 37 | } 38 | 39 | } /* yajr::rpc namespace */ 40 | } /* yajr namespace */ 41 | 42 | -------------------------------------------------------------------------------- /libopflex/comms/rpc/message/factory/lookup_method.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | #include 17 | 18 | namespace fnv_1a_64 = yajr::rpc::internal::fnv_1a_64; 19 | 20 | namespace yajr { 21 | namespace rpc { 22 | 23 | MethodName const * 24 | MessageFactory::lookupMethod(char const * method) { 25 | VLOG(6) 26 | << method 27 | ; 28 | #undef PERFECT_RET_VAL 29 | #define PERFECT_RET_VAL(method) \ 30 | &method 31 | #include 32 | } 33 | 34 | } /* yajr::rpc namespace */ 35 | } /* yajr namespace */ 36 | 37 | -------------------------------------------------------------------------------- /libopflex/comms/test/ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDQjCCAqugAwIBAgIJALpRzqhI6RWsMA0GCSqGSIb3DQEBBQUAMHQxCzAJBgNV 3 | BAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzEUMBIG 4 | A1UEChMLT3BmbGV4LVJvb3QxFDASBgNVBAsTC09wZmxleC1Sb290MRQwEgYDVQQD 5 | EwtPcGZsZXgtUm9vdDAgFw0xNzAxMTEyMTA5NDVaGA80NzU0MTIwODIxMDk0NVow 6 | dDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1TYW4gRnJhbmNp 7 | c2NvMRQwEgYDVQQKEwtPcGZsZXgtUm9vdDEUMBIGA1UECxMLT3BmbGV4LVJvb3Qx 8 | FDASBgNVBAMTC09wZmxleC1Sb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB 9 | gQC5vm1bxZlt0hPZtzVFt3aqc6uryLPmkFKp2eyWvdRTPE0rHtI+HHxsJSMfwHQE 10 | JgFEczpAu/FKPKOHF9z/Gh3G58f+Z9J4zjsvlvyx4IWtG+3tv8iGRzM1dbN5BltP 11 | b49RmHTuwQGQsLfIKrq2K+p1ktlcYQ0ynchSht/PKoZyKwIDAQABo4HZMIHWMB0G 12 | A1UdDgQWBBTbQUDcdY5iNj/SOiVsPUc6Y4SBlTCBpgYDVR0jBIGeMIGbgBTbQUDc 13 | dY5iNj/SOiVsPUc6Y4SBlaF4pHYwdDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNB 14 | MRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMRQwEgYDVQQKEwtPcGZsZXgtUm9vdDEU 15 | MBIGA1UECxMLT3BmbGV4LVJvb3QxFDASBgNVBAMTC09wZmxleC1Sb290ggkAulHO 16 | qEjpFawwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQBNbe+r6PHCLKCw 17 | /R2ZY59Fb4Xg1NzTgVoU0vq0EdL3drWU5gNHvYpeLVKQlANxK/zcdNKCUciL4EO5 18 | EzcpfDX6mCcWCXN/divjJrZKBRusklg1WRJ4dxYm2/fLvOzr51WztBL+ORo1LkoN 19 | oKzmNfUBu9IwfY+frGrqqQ7SLfrxAw== 20 | -----END CERTIFICATE----- 21 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/error_response/custom.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbErr<&yajr::rpc::method::custom>::process() const { 22 | 23 | LOG(ERROR); 24 | 25 | } 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/error_response/endpoint_declare.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbErr<&yajr::rpc::method::endpoint_declare>::process() const { 22 | 23 | LOG(ERROR); 24 | 25 | } 26 | 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/error_response/endpoint_resolve.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbErr<&yajr::rpc::method::endpoint_resolve>::process() const { 22 | 23 | LOG(ERROR); 24 | 25 | } 26 | 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/error_response/endpoint_undeclare.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbErr<&yajr::rpc::method::endpoint_undeclare>::process() const { 22 | 23 | LOG(ERROR); 24 | 25 | } 26 | 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/error_response/endpoint_unresolve.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbErr<&yajr::rpc::method::endpoint_unresolve>::process() const { 22 | 23 | LOG(ERROR); 24 | 25 | } 26 | 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/error_response/endpoint_update.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbErr<&yajr::rpc::method::endpoint_update>::process() const { 22 | 23 | LOG(ERROR); 24 | 25 | } 26 | 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/error_response/policy_resolve.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbErr<&yajr::rpc::method::policy_resolve>::process() const { 22 | 23 | LOG(ERROR); 24 | 25 | } 26 | 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/error_response/policy_unresolve.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbErr<&yajr::rpc::method::policy_unresolve>::process() const { 22 | 23 | LOG(ERROR); 24 | 25 | } 26 | 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/error_response/policy_update.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbErr<&yajr::rpc::method::policy_update>::process() const { 22 | 23 | LOG(ERROR); 24 | 25 | } 26 | 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/error_response/send_identity.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbErr<&yajr::rpc::method::send_identity>::process() const { 22 | 23 | LOG(ERROR); 24 | 25 | } 26 | 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/error_response/state_report.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbErr<&yajr::rpc::method::state_report>::process() const { 22 | 23 | LOG(ERROR); 24 | 25 | } 26 | 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/error_response/transact.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbErr<&yajr::rpc::method::transact>::process() const { 22 | 23 | LOG(ERROR); 24 | 25 | } 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/list.grep: -------------------------------------------------------------------------------- 1 | send_identity 2 | policy_resolve 3 | policy_unresolve 4 | policy_update 5 | endpoint_declare 6 | endpoint_undeclare 7 | endpoint_resolve 8 | endpoint_unresolve 9 | endpoint_update 10 | state_report 11 | custom 12 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/request/custom.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbReq<&yajr::rpc::method::custom>::process() const { 22 | 23 | VLOG(6); 24 | 25 | } 26 | 27 | } /* yajr::rpc namespace */ 28 | } /* yajr namespace */ 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/request/endpoint_declare.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbReq<&yajr::rpc::method::endpoint_declare>::process() const { 22 | 23 | VLOG(6); 24 | 25 | } 26 | 27 | } /* yajr::rpc namespace */ 28 | } /* yajr namespace */ 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/request/endpoint_resolve.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbReq<&yajr::rpc::method::endpoint_resolve>::process() const { 22 | 23 | VLOG(6); 24 | 25 | } 26 | 27 | } /* yajr::rpc namespace */ 28 | } /* yajr namespace */ 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/request/endpoint_undeclare.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbReq<&yajr::rpc::method::endpoint_undeclare>::process() const { 22 | 23 | VLOG(6); 24 | 25 | } 26 | 27 | } /* yajr::rpc namespace */ 28 | } /* yajr namespace */ 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/request/endpoint_unresolve.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbReq<&yajr::rpc::method::endpoint_unresolve>::process() const { 22 | 23 | VLOG(6); 24 | 25 | } 26 | 27 | } /* yajr::rpc namespace */ 28 | } /* yajr namespace */ 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/request/endpoint_update.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbReq<&yajr::rpc::method::endpoint_update>::process() const { 22 | 23 | VLOG(6); 24 | 25 | } 26 | 27 | } /* yajr::rpc namespace */ 28 | } /* yajr namespace */ 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/request/policy_resolve.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbReq<&yajr::rpc::method::policy_resolve>::process() const { 22 | 23 | VLOG(6); 24 | 25 | } 26 | 27 | } /* yajr::rpc namespace */ 28 | } /* yajr namespace */ 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/request/policy_unresolve.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbReq<&yajr::rpc::method::policy_unresolve>::process() const { 22 | 23 | VLOG(6); 24 | 25 | } 26 | 27 | } /* yajr::rpc namespace */ 28 | } /* yajr namespace */ 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/request/policy_update.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbReq<&yajr::rpc::method::policy_update>::process() const { 22 | 23 | VLOG(6); 24 | 25 | } 26 | 27 | } /* yajr::rpc namespace */ 28 | } /* yajr namespace */ 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/request/send_identity.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbReq<&yajr::rpc::method::send_identity>::process() const { 22 | 23 | VLOG(6); 24 | 25 | } 26 | 27 | } /* yajr::rpc namespace */ 28 | } /* yajr namespace */ 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/request/state_report.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbReq<&yajr::rpc::method::state_report>::process() const { 22 | 23 | VLOG(6); 24 | 25 | } 26 | 27 | } /* yajr::rpc namespace */ 28 | } /* yajr namespace */ 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/request/transact.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbReq<&yajr::rpc::method::transact>::process() const { 22 | 23 | VLOG(6); 24 | 25 | } 26 | 27 | } /* yajr::rpc namespace */ 28 | } /* yajr namespace */ 29 | 30 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/result_response/custom.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbRes<&yajr::rpc::method::custom>::process() const { 22 | 23 | VLOG(6) 24 | << "Got custom reply at " 25 | << getReceived() 26 | ; 27 | 28 | } 29 | 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/result_response/endpoint_declare.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbRes<&yajr::rpc::method::endpoint_declare>::process() const { 22 | 23 | VLOG(6) 24 | << "Got endpoint_declare reply at " 25 | << getReceived() 26 | ; 27 | 28 | } 29 | 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/result_response/endpoint_resolve.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbRes<&yajr::rpc::method::endpoint_resolve>::process() const { 22 | 23 | VLOG(6) 24 | << "Got endpoint_resolve reply at " 25 | << getReceived() 26 | ; 27 | 28 | } 29 | 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/result_response/endpoint_undeclare.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbRes<&yajr::rpc::method::endpoint_undeclare>::process() const { 22 | 23 | VLOG(6) 24 | << "Got endpoint_undeclare reply at " 25 | << getReceived() 26 | ; 27 | 28 | } 29 | 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/result_response/endpoint_unresolve.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbRes<&yajr::rpc::method::endpoint_unresolve>::process() const { 22 | 23 | VLOG(6) 24 | << "Got endpoint_unresolve reply at " 25 | << getReceived() 26 | ; 27 | 28 | } 29 | 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/result_response/endpoint_update.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbRes<&yajr::rpc::method::endpoint_update>::process() const { 22 | 23 | VLOG(6) 24 | << "Got endpoint_update reply at " 25 | << getReceived() 26 | ; 27 | 28 | } 29 | 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/result_response/policy_resolve.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbRes<&yajr::rpc::method::policy_resolve>::process() const { 22 | 23 | VLOG(6) 24 | << "Got policy_resolve reply at " 25 | << getReceived() 26 | ; 27 | 28 | } 29 | 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/result_response/policy_unresolve.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbRes<&yajr::rpc::method::policy_unresolve>::process() const { 22 | 23 | VLOG(6) 24 | << "Got policy_unresolve reply at " 25 | << getReceived() 26 | ; 27 | 28 | } 29 | 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/result_response/policy_update.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbRes<&yajr::rpc::method::policy_update>::process() const { 22 | 23 | VLOG(6) 24 | << "Got policy_update reply at " 25 | << getReceived() 26 | ; 27 | 28 | } 29 | 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/result_response/send_identity.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbRes<&yajr::rpc::method::send_identity>::process() const { 22 | 23 | VLOG(6) 24 | << "Got send_identity reply at " 25 | << getReceived() 26 | ; 27 | 28 | } 29 | 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/result_response/state_report.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbRes<&yajr::rpc::method::state_report>::process() const { 22 | 23 | VLOG(6) 24 | << "Got state_report reply at " 25 | << getReceived() 26 | ; 27 | 28 | } 29 | 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /libopflex/comms/test/handlers/result_response/transact.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #include 16 | 17 | namespace yajr { 18 | namespace rpc { 19 | 20 | template<> 21 | void InbRes<&yajr::rpc::method::transact>::process() const { 22 | 23 | VLOG(6) 24 | << "Got transact reply at " 25 | << getReceived() 26 | ; 27 | 28 | } 29 | 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /libopflex/comms/test/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | /* This must be included before anything else */ 10 | #if HAVE_CONFIG_H 11 | # include 12 | #endif 13 | 14 | 15 | #define BOOST_TEST_MODULE communications 16 | #include 17 | -------------------------------------------------------------------------------- /libopflex/comms/test/stable_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | 3 | CATEGORY=${1:-STABLE} 4 | ulimit -c unlimited 5 | 6 | # Timeout. 7 | declare -i timeout=${2:-120} 8 | # Interval between checks if the process is still alive. 9 | declare -i interval=${3:-5} 10 | # Delay between posting the SIGTERM signal and destroying the process by SIGKILL. 11 | declare -i delay=2 12 | 13 | function watcher() { 14 | ((t = timeout)) 15 | 16 | while ((t > 0)); do 17 | sleep $interval 18 | kill -0 $$ || exit 0 19 | ((t -= interval)) 20 | done 21 | 22 | # Be nice, post SIGTERM first. 23 | # The 'exit 0' below will be executed if any preceeding command fails. 24 | kill -s SIGTERM $$ && kill -0 $$ || exit 0 25 | sleep $delay 26 | kill -s SIGKILL $$ 27 | } 28 | 29 | (watcher) &> /dev/null & 30 | BG_WATCHER=$! 31 | 32 | if [ "${CATEGORY}" == "${CATEGORY//_/}" ] 33 | then 34 | TEST_PATTERN=asynchronous_sockets/${CATEGORY}_test_'*' 35 | else 36 | if [ "${CATEGORY}" == "${CATEGORY//\//}" ] 37 | then 38 | TEST_PATTERN="asynchronous_sockets/${CATEGORY}" 39 | else 40 | TEST_PATTERN="${CATEGORY}" 41 | fi 42 | fi 43 | 44 | ./comms_test --catch_system_errors=no --run_test="${TEST_PATTERN}" 45 | RET_VAL=$? 46 | kill -9 ${BG_WATCHER} &> /dev/null 47 | 48 | exit ${RET_VAL} 49 | -------------------------------------------------------------------------------- /libopflex/cwrapper/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # libopflex: a framework for developing opflex-based policy agents 3 | # Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 4 | # 5 | # This program and the accompanying materials are made available under the 6 | # terms of the Eclipse Public License v1.0 which accompanies this distribution, 7 | # and is available at http://www.eclipse.org/legal/epl-v10.html 8 | # 9 | ########### 10 | # 11 | # Process this file with automake to produce a Makefile.in 12 | 13 | SUBDIRS = . test 14 | 15 | AM_CPPFLAGS = $(BOOST_CPPFLAGS) \ 16 | -Wall \ 17 | -Werror \ 18 | -I$(srcdir)/include -I$(top_srcdir)/include 19 | 20 | if ENABLE_TSAN 21 | AM_CPPFLAGS += -fsanitize=thread 22 | endif 23 | 24 | if ENABLE_ASAN 25 | AM_CPPFLAGS += -fsanitize=address 26 | endif 27 | 28 | if ENABLE_COVERAGE 29 | AM_CPPFLAGS += --coverage 30 | endif 31 | 32 | noinst_LTLIBRARIES = libcwrapper.la 33 | 34 | libcwrapper_la_SOURCES = \ 35 | ofloghandler.cpp \ 36 | ofobjectlistener.cpp \ 37 | ofuri.cpp \ 38 | ofmutator.cpp \ 39 | offramework.cpp \ 40 | ofpeerstatuslistener.cpp 41 | -------------------------------------------------------------------------------- /libopflex/cwrapper/test/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* This must be included before anything else */ 3 | #if HAVE_CONFIG_H 4 | # include 5 | #endif 6 | 7 | 8 | #define BOOST_TEST_MODULE "C Wrapper" 9 | #include 10 | -------------------------------------------------------------------------------- /libopflex/debian/changelog.in: -------------------------------------------------------------------------------- 1 | libopflex (@PACKAGE_VERSION@-@SDK_BVERSION@) bionic; urgency=medium 2 | 3 | * Updated for 18.04 4 | 5 | -- Tom Flynn Wed, 25 Sep 2019 23:07:13 -0700 6 | 7 | libopflex (1.1.0-1) unstable; urgency=medium 8 | 9 | * Updated for 16.04 10 | 11 | -- Rob Adams Tue, 07 Jun 2016 13:45:13 -0700 12 | 13 | libopflex (0.1.0-1) unstable; urgency=low 14 | 15 | * Initial release 16 | 17 | -- Amit Bose Thu, 19 Mar 2015 17:26:56 -0700 18 | -------------------------------------------------------------------------------- /libopflex/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /libopflex/debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: libopflex 3 | Source: https://wiki.opendaylight.org/view/OpFlex:Main 4 | 5 | Files: * 6 | Copyright: Copyright 2015 Cisco Systems, Inc. 7 | License: Eclipse Public License v1.0 8 | -------------------------------------------------------------------------------- /libopflex/debian/libopflex-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/opflex/* 2 | usr/lib/*/lib*.a 3 | usr/lib/*/lib*.la 4 | usr/lib/*/pkgconfig/* 5 | usr/share/doc/libopflex usr/share/doc/ 6 | -------------------------------------------------------------------------------- /libopflex/debian/libopflex.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/lib*.so* 2 | -------------------------------------------------------------------------------- /libopflex/debian/rules.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | 4 | # Uncomment this to turn on verbose mode. 5 | #export DH_VERBOSE=1 6 | 7 | %: 8 | dh $@ --parallel --with autotools-dev 9 | 10 | override_dh_auto_test: 11 | 12 | override_dh_auto_configure: 13 | dh_auto_configure -- --disable-assert --with-buildversion=@SDK_BVERSION@ 14 | 15 | override_dh_auto_test: 16 | if ! make check; then find . -name test-suite.log -exec cat {} \; && false; fi 17 | 18 | override_dh_auto_install: 19 | $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install 20 | 21 | override_dh_shlibdeps: 22 | dh_shlibdeps -- --ignore-missing-info 23 | 24 | override_dh_strip: 25 | dh_strip --dbg-package=libopflex-dbg 26 | -------------------------------------------------------------------------------- /libopflex/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /libopflex/doc/.gitignore: -------------------------------------------------------------------------------- 1 | Doxyfile 2 | Doxyfile-internal 3 | /html/* 4 | /html-internal/* 5 | /latex/* 6 | /latex-internal/* 7 | /doxygen_*.db -------------------------------------------------------------------------------- /libopflex/engine/OpflexMessage.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Implementation for OpflexMessage 4 | * 5 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | /* This must be included before anything else */ 13 | #if HAVE_CONFIG_H 14 | # include 15 | #endif 16 | 17 | 18 | #include "opflex/engine/internal/OpflexMessage.h" 19 | 20 | namespace opflex { 21 | namespace engine { 22 | namespace internal { 23 | 24 | OpflexMessage::OpflexMessage(const std::string& method_, MessageType type_, 25 | const rapidjson::Value* id_) 26 | : jsonrpc::JsonRpcMessage(method_, type_, id_) { 27 | } 28 | 29 | void GenericOpflexMessage::serializePayload(yajr::rpc::SendHandler& writer) { 30 | (*this)(writer); 31 | } 32 | 33 | } /* namespace internal */ 34 | } /* namespace engine */ 35 | } /* namespace opflex */ 36 | -------------------------------------------------------------------------------- /libopflex/engine/test/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* This must be included before anything else */ 3 | #if HAVE_CONFIG_H 4 | # include 5 | #endif 6 | 7 | 8 | #define BOOST_TEST_MODULE "Engine" 9 | #include 10 | 11 | #include "opflex/logging/StdOutLogHandler.h" 12 | 13 | using namespace opflex::logging; 14 | 15 | class EngineTest { 16 | public: 17 | EngineTest() { 18 | OFLogHandler::registerHandler(testLogger); 19 | } 20 | 21 | static StdOutLogHandler testLogger; 22 | }; 23 | 24 | StdOutLogHandler EngineTest::testLogger(OFLogHandler::DEBUG2); 25 | 26 | BOOST_GLOBAL_FIXTURE(EngineTest); 27 | -------------------------------------------------------------------------------- /libopflex/include/opflex/gbp/Policy.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /*! 3 | * @file Policy.h 4 | * @brief Interface definition file for GBP policy 5 | */ 6 | /* 7 | * Copyright (c) 2019 Cisco Systems, Inc. and others. All rights reserved. 8 | * 9 | * This program and the accompanying materials are made available under the 10 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 11 | * and is available at http://www.eclipse.org/legal/epl-v10.html 12 | */ 13 | 14 | #ifndef GBP_POLICY_H 15 | #define GBP_POLICY_H 16 | 17 | namespace opflex { 18 | namespace gbp { 19 | 20 | enum class PolicyUpdateOp { 21 | /** 22 | * add MO and merge children 23 | */ 24 | ADD, 25 | /** 26 | * replace MO and its children 27 | */ 28 | REPLACE, 29 | /** 30 | * delete MO alone 31 | */ 32 | DELETE, 33 | /** 34 | * recursively delete MO and its children 35 | */ 36 | DELETE_RECURSIVE, 37 | }; 38 | 39 | } /* namespace gbp */ 40 | } /* namespace opflex */ 41 | #endif /* GBP_POLICY_H */ 42 | -------------------------------------------------------------------------------- /libopflex/include/opflex/ofcore/MainLoopAdaptor.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /*! 3 | * @file MainLoopAdaptor.h 4 | * @brief Interface definition for main loop adaptor 5 | */ 6 | /* 7 | * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved. 8 | * 9 | * This program and the accompanying materials are made available under the 10 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 11 | * and is available at http://www.eclipse.org/legal/epl-v10.html 12 | */ 13 | 14 | #pragma once 15 | #ifndef OPFLEX_CORE_MAINLOOPADAPTOR_H 16 | #define OPFLEX_CORE_MAINLOOPADAPTOR_H 17 | 18 | namespace opflex { 19 | namespace ofcore { 20 | 21 | /** 22 | * \addtogroup ofcore 23 | * @{ 24 | */ 25 | 26 | /** 27 | * An adaptor that allows integrating libopflex with an external main 28 | * loop. If using a main loop adaptor, libopflex will not create any 29 | * threads of its own. 30 | */ 31 | class MainLoopAdaptor { 32 | public: 33 | /** 34 | * Run one iteration of the main loop, and return when complete. 35 | * Call this for each iteration of your main loop after calling 36 | * OFFramework::start. This function will not block. 37 | */ 38 | virtual void runOnce() = 0; 39 | }; 40 | 41 | /** @} ofcore */ 42 | 43 | } /* namespace ofcore */ 44 | } /* namespace opflex */ 45 | 46 | #endif /* OPFLEX_CORE_MAINLOOPADAPTOR_H */ 47 | -------------------------------------------------------------------------------- /libopflex/include/opflex/util/LockGuard.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /*! 3 | * @file LockGuard.h 4 | * @brief Interface definition file for LockGuard 5 | */ 6 | /* 7 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 8 | * 9 | * This program and the accompanying materials are made available under the 10 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 11 | * and is available at http://www.eclipse.org/legal/epl-v10.html 12 | */ 13 | 14 | #ifndef OPFLEX_UTIL_LOCKGUARD_H 15 | #define OPFLEX_UTIL_LOCKGUARD_H 16 | 17 | #include 18 | 19 | namespace opflex { 20 | namespace util { 21 | 22 | /** 23 | * @brief Lock guard will aquire a libuv mutex on construction and 24 | * release it on destruction. 25 | */ 26 | class LockGuard { 27 | public: 28 | /** 29 | * Acquire the lock 30 | */ 31 | LockGuard(uv_mutex_t* mutex); 32 | 33 | /** 34 | * Release the lock 35 | */ 36 | ~LockGuard(); 37 | 38 | /** 39 | * Release the lock 40 | */ 41 | void release(); 42 | 43 | private: 44 | uv_mutex_t* mutex; 45 | bool locked; 46 | }; 47 | 48 | } /* namespace util */ 49 | } /* namespace opflex */ 50 | 51 | #endif /* OPFLEX_UTIL_LOCKGUARD_H */ 52 | -------------------------------------------------------------------------------- /libopflex/include/opflex/yajr/transport/PlainText.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 6 | * and is available at http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | 9 | #pragma once 10 | #ifndef _____COMMS__INCLUDE__YAJR__TRANSPORT__PLAINTEXT_HPP 11 | #define _____COMMS__INCLUDE__YAJR__TRANSPORT__PLAINTEXT_HPP 12 | 13 | #include 14 | 15 | namespace yajr { 16 | namespace transport { 17 | 18 | /** 19 | * Plain text transport 20 | */ 21 | class PlainText : public Transport::Engine { 22 | public: 23 | /** 24 | * Get the plain text transport 25 | * @return transport 26 | */ 27 | static TransportEngine< PlainText > & getPlainTextTransport(); 28 | private: 29 | PlainText(); 30 | PlainText(const PlainText &); 31 | PlainText & operator=(const PlainText &); 32 | }; 33 | 34 | template< > 35 | inline TransportEngine< PlainText >::~TransportEngine() { 36 | } 37 | 38 | } /* yajr::transport namespace */ 39 | } /* yajr namespace */ 40 | 41 | #endif /* _____COMMS__INCLUDE__YAJR__TRANSPORT__PLAINTEXT_HPP */ 42 | 43 | -------------------------------------------------------------------------------- /libopflex/libopflex.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: @PACKAGE@ 7 | Description: OpFlex Framework 8 | Version: @VERSION@ 9 | Requires.private: libuv 10 | Libs: -L${libdir} -lopflex 11 | Libs.private: @LIBS@ 12 | Cflags: -I${includedir} @BOOST_CPPFLAGS@ 13 | -------------------------------------------------------------------------------- /libopflex/logging/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # libopflex: a framework for developing opflex-based policy agents 3 | # Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 4 | # 5 | # This program and the accompanying materials are made available under the 6 | # terms of the Eclipse Public License v1.0 which accompanies this distribution, 7 | # and is available at http://www.eclipse.org/legal/epl-v10.html 8 | # 9 | ########### 10 | # 11 | # Process this file with automake to produce a Makefile.in 12 | 13 | noinst_LTLIBRARIES = 14 | noinst_LTLIBRARIES += liblogging.la 15 | 16 | AM_CPPFLAGS = \ 17 | -Wall \ 18 | -Werror \ 19 | -I$(srcdir)/include \ 20 | -I$(top_srcdir)/include 21 | 22 | if ENABLE_TSAN 23 | AM_CPPFLAGS += -fsanitize=thread 24 | endif 25 | 26 | if ENABLE_ASAN 27 | AM_CPPFLAGS += -fsanitize=address 28 | endif 29 | 30 | if ENABLE_COVERAGE 31 | AM_CPPFLAGS += --coverage 32 | endif 33 | 34 | liblogging_la_SOURCES = \ 35 | include/opflex/logging/internal/logging.hpp \ 36 | OFLogHandler.cpp \ 37 | StdOutLogHandler.cpp \ 38 | logging.cpp 39 | 40 | -------------------------------------------------------------------------------- /libopflex/logging/OFLogHandler.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Implementation for OFLogHandler class. 4 | * 5 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | /* This must be included before anything else */ 13 | #if HAVE_CONFIG_H 14 | # include 15 | #endif 16 | 17 | #include 18 | #include "opflex/logging/OFLogHandler.h" 19 | #include "opflex/logging/StdOutLogHandler.h" 20 | 21 | namespace opflex { 22 | namespace logging { 23 | 24 | static boost::atomic activeHandler(NULL); 25 | 26 | OFLogHandler::OFLogHandler(Level logLevel) : logLevel_(logLevel) { }; 27 | OFLogHandler::~OFLogHandler() { } 28 | 29 | void OFLogHandler::registerHandler(OFLogHandler& handler) { 30 | activeHandler = &handler; 31 | } 32 | 33 | OFLogHandler* OFLogHandler::getHandler() { 34 | static StdOutLogHandler defaultHandler(INFO); 35 | if (activeHandler) return activeHandler; 36 | return &defaultHandler; 37 | } 38 | 39 | bool OFLogHandler::shouldEmit(const Level level) { 40 | return level >= logLevel_; 41 | } 42 | 43 | } /* namespace logging */ 44 | } /* namespace opflex */ 45 | -------------------------------------------------------------------------------- /libopflex/modb/EnumInfo.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Implementation for EnumInfo class. 4 | * 5 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | /* This must be included before anything else */ 13 | #if HAVE_CONFIG_H 14 | # include 15 | #endif 16 | 17 | 18 | #include 19 | 20 | #include "opflex/modb/EnumInfo.h" 21 | 22 | namespace opflex { 23 | namespace modb { 24 | 25 | EnumInfo::EnumInfo(const std::string &name_, 26 | const std::vector& consts_) 27 | : name(name_) { 28 | BOOST_FOREACH(const ConstInfo& cinst, consts_) { 29 | const_name_map[cinst.getName()] = cinst.getId(); 30 | const_value_map[cinst.getId()] = cinst.getName(); 31 | } 32 | } 33 | 34 | EnumInfo::~EnumInfo() { 35 | } 36 | 37 | const uint64_t EnumInfo::getIdByName(const std::string& name) const { 38 | return const_name_map.at(name); 39 | } 40 | 41 | const std::string& EnumInfo::getNameById(uint64_t id) const { 42 | return const_value_map.at(id); 43 | } 44 | 45 | } /* namespace modb */ 46 | } /* namespace opflex */ 47 | -------------------------------------------------------------------------------- /libopflex/modb/ModelMetadata.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Implementation for ModelMetadata class. 4 | * 5 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | /* This must be included before anything else */ 13 | #if HAVE_CONFIG_H 14 | # include 15 | #endif 16 | 17 | 18 | #include "opflex/modb/ModelMetadata.h" 19 | 20 | namespace opflex { 21 | namespace modb { 22 | 23 | ModelMetadata::ModelMetadata(const std::string& name, 24 | const std::vector& classes_) 25 | : classes(classes_) { 26 | 27 | } 28 | 29 | ModelMetadata::~ModelMetadata() { 30 | } 31 | 32 | } /* namespace modb */ 33 | } /* namespace opflex */ 34 | -------------------------------------------------------------------------------- /libopflex/modb/test/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* This must be included before anything else */ 3 | #if HAVE_CONFIG_H 4 | # include 5 | #endif 6 | 7 | 8 | #define BOOST_TEST_MODULE "Managed Object Database" 9 | #include 10 | -------------------------------------------------------------------------------- /libopflex/ofcore/test/FrameworkFixture.h: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Include file for base framework fixture 4 | * 5 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #ifndef CORE_TEST_FRAMEWORKFIXTURE_H 13 | #define CORE_TEST_FRAMEWORKFIXTURE_H 14 | 15 | #include "opflex/ofcore/OFFramework.h" 16 | #include "MDFixture.h" 17 | 18 | namespace opflex { 19 | namespace ofcore { 20 | 21 | /** 22 | * A fixture that adds a framework instance 23 | */ 24 | class FrameworkFixture : public modb::MDFixture { 25 | public: 26 | FrameworkFixture() 27 | : MDFixture() { 28 | framework.setModel(md); 29 | framework.start(); 30 | } 31 | 32 | ~FrameworkFixture() { 33 | framework.stop(); 34 | } 35 | 36 | MockOFFramework framework; 37 | }; 38 | 39 | } /* namespace modb */ 40 | } /* namespace opflex */ 41 | 42 | #endif /* CORE_TEST_FRAMEWORKFIXTURE_H */ 43 | -------------------------------------------------------------------------------- /libopflex/ofcore/test/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* This must be included before anything else */ 3 | #if HAVE_CONFIG_H 4 | # include 5 | #endif 6 | 7 | 8 | #define BOOST_TEST_MODULE "Core" 9 | #include 10 | -------------------------------------------------------------------------------- /libopflex/util/LockGuard.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Implementation for LockGuard class. 4 | * 5 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | /* This must be included before anything else */ 13 | #if HAVE_CONFIG_H 14 | # include 15 | #endif 16 | 17 | #include "opflex/util/LockGuard.h" 18 | 19 | namespace opflex { 20 | namespace util { 21 | 22 | LockGuard::LockGuard(uv_mutex_t* mutex_) 23 | : mutex(mutex_), locked(true) { 24 | uv_mutex_lock(mutex); 25 | } 26 | 27 | LockGuard::~LockGuard() { 28 | release(); 29 | } 30 | 31 | void LockGuard::release() { 32 | if (locked) 33 | uv_mutex_unlock(mutex); 34 | locked = false; 35 | } 36 | 37 | } /* namespace util */ 38 | } /* namespace opflex */ 39 | -------------------------------------------------------------------------------- /libopflex/util/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # libopflex: a framework for developing opflex-based policy agents 3 | # Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 4 | # 5 | # This program and the accompanying materials are made available under the 6 | # terms of the Eclipse Public License v1.0 which accompanies this distribution, 7 | # and is available at http://www.eclipse.org/legal/epl-v10.html 8 | # 9 | ########### 10 | # 11 | # Process this file with automake to produce a Makefile.in 12 | 13 | AM_CPPFLAGS = $(BOOST_CPPFLAGS) -Wall -Werror \ 14 | -I$(srcdir)/include -I$(top_srcdir)/include 15 | 16 | if ENABLE_TSAN 17 | AM_CPPFLAGS += -fsanitize=thread 18 | endif 19 | 20 | if ENABLE_ASAN 21 | AM_CPPFLAGS += -fsanitize=address 22 | endif 23 | 24 | if ENABLE_COVERAGE 25 | AM_CPPFLAGS += --coverage 26 | endif 27 | 28 | noinst_LTLIBRARIES = libutil.la 29 | 30 | libutil_la_CXXFLAGS = $(UV_CFLAGS) 31 | 32 | libutil_la_LIBADD = $(UV_LIBS) 33 | libutil_la_SOURCES = \ 34 | LockGuard.cpp \ 35 | RecursiveLockGuard.cpp \ 36 | ThreadManager.cpp 37 | -------------------------------------------------------------------------------- /libopflex/util/RecursiveLockGuard.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Implementation for RecursiveLockGuard class. 4 | * 5 | * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | /* This must be included before anything else */ 13 | #if HAVE_CONFIG_H 14 | # include 15 | #endif 16 | 17 | #include "opflex/util/RecursiveLockGuard.h" 18 | 19 | namespace opflex { 20 | namespace util { 21 | 22 | RecursiveLockGuard::RecursiveLockGuard(uv_mutex_t* mutex_, 23 | uv_key_t* mutex_key_) 24 | : mutex(mutex_), mutex_key(mutex_key_), locked(true) { 25 | void* lkey = uv_key_get(mutex_key); 26 | if (!lkey) { 27 | uv_mutex_lock(mutex); 28 | uv_key_set(mutex_key, (void*)1); 29 | } 30 | } 31 | 32 | RecursiveLockGuard::~RecursiveLockGuard() { 33 | release(); 34 | } 35 | 36 | void RecursiveLockGuard::release() { 37 | void* lkey = uv_key_get(mutex_key); 38 | if (lkey) { 39 | uv_mutex_unlock(mutex); 40 | uv_key_set(mutex_key, 0); 41 | } 42 | locked = false; 43 | } 44 | 45 | } /* namespace util */ 46 | } /* namespace opflex */ 47 | -------------------------------------------------------------------------------- /sample/renderer/.gitignore: -------------------------------------------------------------------------------- 1 | build* 2 | Makefile 3 | Makefile.in 4 | core 5 | .deps 6 | .libs 7 | *.o 8 | *.lo 9 | *.la 10 | *_test 11 | install-sh 12 | libtool 13 | ltmain.sh 14 | missing 15 | cscope* 16 | config.guess 17 | autom4te.cache 18 | aclocal.m4 19 | config.h 20 | config.h.in 21 | config.log 22 | config.status 23 | config.sub 24 | configure 25 | depcomp 26 | *~ 27 | errors.err 28 | :q 29 | q 30 | :qa 31 | qa 32 | :wqa 33 | wqa 34 | stamp-h1 35 | libopflex.pc 36 | compile 37 | test-driver 38 | *.log 39 | *.trs 40 | m4/libtool.m4 41 | m4/lt*.m4 42 | .cproject 43 | .project 44 | .settings 45 | .tags 46 | .tags_sorted_by_file 47 | .dirstamp 48 | *.rpm 49 | *.spec 50 | *.tar.gz 51 | -------------------------------------------------------------------------------- /sample/renderer/SampleRenderer_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Test suite for SampleRenderer 3 | * 4 | * Copyright (c) 2018 Cisco Systems, Inc. and others. All rights reserved. 5 | * 6 | * This program and the accompanying materials are made available under the 7 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 8 | * and is available at http://www.eclipse.org/legal/epl-v10.html 9 | */ 10 | 11 | #include 12 | 13 | #include 14 | 15 | #include "SampleRenderer.h" 16 | 17 | BOOST_AUTO_TEST_SUITE(SampleRenderer_test) 18 | 19 | BOOST_FIXTURE_TEST_CASE(sample, opflexagent::ModbFixture) { 20 | samplerenderer::SampleRenderer sample(agent); 21 | sample.start(); 22 | sample.stop(); 23 | } 24 | 25 | BOOST_AUTO_TEST_SUITE_END() 26 | -------------------------------------------------------------------------------- /sample/renderer/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # sample-renderer: Sample OpFlex agent renderer plugin 4 | # Copyright (c) 2018 Cisco Systems, Inc. and others. All rights reserved. 5 | # 6 | # This program and the accompanying materials are made available under the 7 | # terms of the Eclipse Public License v1.0 which accompanies this distribution, 8 | # and is available at http://www.eclipse.org/legal/epl-v10.html 9 | 10 | # This autogen script will run the autotools to generate the build 11 | # system. You should run this script in order to initialize a build 12 | # immediately following a checkout. 13 | 14 | for i in m4/* 15 | do 16 | if [ -L "${i}" ] 17 | then 18 | rm "${i}" 19 | fi 20 | done 21 | 22 | autoreconf -fis 23 | -------------------------------------------------------------------------------- /sample/renderer/plugin-renderer-sample.conf: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": { 3 | // Load sample renderer plugin 4 | "renderer": ["libopflex_agent_renderer_sample.so"] 5 | }, 6 | 7 | "renderers": { 8 | // Sample renderer configuration 9 | "sample": { 10 | // Put configuration specific to renderer plugin here. 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /sample/renderer/sample_test.cpp: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ 2 | /* 3 | * Test suite for for sample plugin 4 | * 5 | * Copyright (c) 2018 Cisco Systems, Inc. and others. All rights reserved. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License v1.0 which accompanies this distribution, 9 | * and is available at http://www.eclipse.org/legal/epl-v10.html 10 | */ 11 | 12 | #define BOOST_TEST_MODULE "OpFlex Agent Sample Plugin" 13 | #include 14 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | minversion = 1.6 3 | envlist = 4 | docs 5 | docs-linkcheck 6 | skipsdist = true 7 | 8 | [testenv:docs] 9 | deps = -rdocs/requirements.txt 10 | commands = 11 | sphinx-build -W -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html 12 | 13 | [testenv:docs-linkcheck] 14 | deps = -rdocs/requirements.txt 15 | commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck 16 | 17 | --------------------------------------------------------------------------------