您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 公司方案 > Floodlight--REST-API控制器接口
TheFloodlightRESTAPITheRESTAPIistherecommendedinterfacetodevelopapplicationsutilizingFloodlightsupportedfeatures.FortheRESTcallsthatuseswitchDPID,youcanobtainitfromfloodlightUI.Afterthefloodlightisupandrunning,youcangotoyourbrowserandtypeinaURLasfollows(Replace192.168.110.2withtheproperinetaddress).WhilethefunctionsavailableinthisAPIareevolving,severalkeyfunctionsaresupportedtoday.TheAPIisavailableatport8080ofthecontroller.AnexampleRESTcallis:curl:URIMethodDescriptionArguments/wm/core/switch/all/statType/jsonGETRetrieveaggregatestatsacrossallswitchesstatType:port,queue,flow,aggregate,desc,table,features/wm/core/switch/switchId/statType/jsonGETRetrieveperswitchstatsswitchId:ValidSwitchDPID(XX:XX:XX:XX:XX:XX:XX:XX)statType:port,queue,flow,aggregate,desc,table,features/wm/core/controller/switches/jsonGETListofallswitchDPIDsconnectedtothecontrollernone/wm/core/controller/summary/jsonGETControllersummary(#ofSwitches,#ofLinks,etc)none/wm/core/counter/counterTitle/jsonGETListofglobaltrafficcountersinthecontroller(acrossallswitches)counterTitle:allorsomethingoftheformDPID_COUNTER_NAME_SUB_CATEGORYie.00:00:00:00:00:00:00:01_OFPacketIn_broadcast(SUB_CATEGORYbeingbroadcast)00:00:00:00:00:00:00:01_OFPacketIn_L3_ARP(SUB_CATEGORYbeingL3_ARP)L3sub_categoriestaketheformL3_ether-type,L4sub_categoriestaketheformL4_protocolFormoredetailslookatnet.floodlightcontroller.counter.CounterStore.java/wm/core/counter/switchId/counterName/jsonGETListoftrafficcountersperswitchswitchId:ValidSwitchDPIDCounterTitle:seeabove/wm/core/memory/jsonGETCurrentcontrollermemoryusagenone/wm/core/health/jsonGETStatus/HealthofRESTAPInone/wm/core/systen/uptime/jsonGETControlleruptimenone/wm/topology/links/jsonGETListalltheinter-switchlinks.Notethattheseareonlyforswitchesconnectedtothesamecontroller.noneThisisnotavailableinthe0.8release./wm/topology/switchclusters/jsonGETListofallswitchclustersconnectedtothecontroller.Thisisnotavailableinthe0.8release.none/wm/topology/external-links/jsonGETShowexternallinks,i.e.,multi-hoplinksdiscoveredbyBDDPinsteadofLLDPpacketsnone/wm/topology/links/jsonGETShowDIRECTandTUNNELlinksdiscoveredbasedonLLDPpacketsnone/wm/device/GETListofalldevicestrackedbythecontroller.ThisincludesMACs,IPs,andattachmentpoints.PassedasGETparameters:mac(colon-separatedhex-encoded),ipv4(dotteddecimal),vlan,dpidattachmentpointDPID(colon-separatedhex-encoded)andporttheattachmentpointport./wm/staticflowentrypusher/jsonPOST/DELETEAdd/DeletestaticflowHTTPPOSTdata(addflow),HTTPDELETE(fordeletion)/wm/staticflowentrypusher/list/switch/jsonGETListstaticflowsforaswitchorallswitchesswitch:ValidSwitchDPID(XX:XX:XX:XX:XX:XX:XX:XX)orall/wm/staticflowentrypusher/clear/switch/jsonGETClearstaticflowsforaswitchorallswitchesswitch:ValidSwitchDPID(XX:XX:XX:XX:XX:XX:XX:XX)orallMoreinformationavailableonHowtoUseStaticFlowPusherAPI/networkService/v1.1/tenants/tenant/networks/networkPUT/POST/DELETECreatesanewvirtualnetwork.NameandIDarerequired,gatewayisoptional.URIargument:tenant:Currentlyignored.network:ID(notname)ofthenetworkHTTPdata:{network:{gateway:IP,name:Name}}IP:GatewayIPin1.1.1.1format,canbenullName:Networknameasstring/networkService/v1.1/tenants/tenant/networks/network/ports/port/attachmentPUT/DELETEAttachesahosttoavirtualnetwork.URIargument:tenant:Currentlyignored.network:ID(notname)ofthenetwork.port:LogicalportnameHTTPdata:{attachment:{id:NetworkID,mac:MAC}}NetworkID:NetworkIDasstring,theoneassignedatcreateMAC:MACaddressinXX:XX:XX:XX:XX:XXformat/networkService/v1.1/tenants/tenant/networksGETShowsallnetworksandtheirgateway,ID,andhostsmacinURIargument:tenant:Currentlyignored.jsonformat.MoreinformationavailableonVirtualNetworkFilterRESTAPI/wm/firewall/module/op/jsonGETquerythestatusof,enable,anddisablethefirewall/wm/firewall/rules/jsonGET/POST/DELETEGET:NonePOST:{field1:value1,field2:value2,...}DELETE:{ruleid:int}ListallexistingrulesinjsonformatCreatenewfirewallruleDeletearulebyruleidfield:valuepairsbelowinanyorderandcombination:switchid:xx:xx:xx:xx:xx:xx:xx:xx,src-inport:short,src-mac:xx:xx:xx:xx:xx:xx,dst-mac:xx:xx:xx:xx:xx:xx,dl-type:ARPorIPv4,src-ip:A.B.C.D/M,dst-ip:A.B.C.D/M,nw-proto:TCPorUDPorICMP,tp-src:short,tp-dst:short,priority:int,action:ALLOWorDENYruleid:intMoreinformationavailableonFirewallRESTAPIForFloodlightdevelopers,checkouthowtoaddnewRESTAPIstoFloodlightservicesatHowtoAddServicestoaModule.FirewallRESTAPIAddedbyKuang-ChingWang,lasteditedbyJasonParragaonJun12,2013(viewchange)FirewallRESTInterfaceTheFirewallModuleexposesRESTinterfaceimplementedasRestletRoutableusingRestAPIService.FollowingisalistofRESTmethodsexposed:URIMethodURIArgumentsDataDataFieldsDescription/wm/firewall/module/op/jsonGETop:status,enable,disable,storageRules,subnet-maskNoneNonequerythestatusof,enable,anddisablethefirewall/wm/firewall/rules/jsonGETNoneNoneNoneLis
本文标题:Floodlight--REST-API控制器接口
链接地址:https://www.777doc.com/doc-5336611 .html