// Activate implements Mechanism interface
169890
func (m *ARPMechanism) Activate() {
	m.BaseMechanism.Activate()

	// Operate on PacketIn messages
	m.cookies.Baker = ofputil.PacketInBaker()

	// Allocate table for handling arp protocol.
	tableNo, err := m.C.Switch.AllocateTable()
	if err != nil {
		log.ErrorLog("arp/ACTIVATE_HOOK",
			"Failed to allocate a new table: ", err)
		return
	}

	m.tableNo = tableNo

	log.DebugLog("arp/ACTIVATE_HOOK",
		"Allocated table: ", tableNo)

	// Match packets of ARP protocol.
	match := ofp.Match{ofp.MT_OXM, []ofp.OXM{
		ofputil.EthType(uint16(iana.ETHT_ARP), nil),
	}}

	// Move all packets to allocated matching table for ARP packets.
	instructions := ofp.Instructions{ofp.InstructionGotoTable{ofp.Table(m.tableNo)}}

	// Insert flow into 0 table.
	flowModGoto, err := of.NewRequest(of.T_FLOW_MOD, of.NewReader(&ofp.FlowMod{
		Command:      ofp.FC_ADD,
		BufferID:     ofp.NO_BUFFER,
		Priority:     20,
		Match:        match,
		Instructions: instructions,
	}))

	if err != nil {
		log.ErrorLog("arp/ACTIVATE_HOOK",
			"Failed to create ofp_flow_mod request: ", err)
		return
	}

	err = of.Send(m.C.Switch.Conn(),
		// Flush flows from table before using it.
		ofputil.TableFlush(ofp.Table(m.tableNo)),
		// Create black-hole rule for non-matching packets.
		ofputil.FlowDrop(ofp.Table(m.tableNo)),
		// Redirect all ARP requests to allocated table to process.
		flowModGoto,
	)

	if err != nil {
		log.ErrorLog("arp/ACTIVATE_HOOK",
			"Failed to send requests: ", err)
	}
}
317719
func (ssa *SQLStorageAuthority) DeactivateRegistration(ctx context.Context, id int64) error {
	_, err := ssa.dbMap.WithContext(ctx).Exec(
		"UPDATE registrations SET status = ? WHERE status = ? AND id = ?",
		string(core.StatusDeactivated),
		string(core.StatusValid),
		id,
	)
	return err
}
1120400
func (s *InstanceInformation) SetActivationId(v string) *InstanceInformation {
	s.ActivationId = &v
	return s
}
1312799
func (m *Migrator) activateBoltStore() error {
	op := "Moving Bolt file into place"
	m.sendProgress(op, 0, 1)

	if err := os.Rename(m.boltTempPath, m.boltPath); err != nil {
		return err
	}

	m.sendProgress(op, 1, 1)
	return nil
}
537905
func (t *Task) Activate(c context.Context, s dm.DepsServer) (*ActivatedTask, error) {
	newTok := model.MakeRandomToken(c, 32)
	_, err := s.ActivateExecution(c, &dm.ActivateExecutionReq{
		Auth: t.Auth, ExecutionToken: newTok})
	if err != nil {
		return nil, err
	}

	return &ActivatedTask{
		s,
		c,
		&dm.Execution_Auth{Id: t.Auth.Id, Token: newTok},
		t.Desc,
		t.State,
	}, nil
}
172008
func (s *ProjectService) NewActivateProjectParams(id string) *ActivateProjectParams {
	p := &ActivateProjectParams{}
	p.p = make(map[string]interface{})
	p.p["id"] = id
	return p
}
667860
func (c *DefaultClient) SubscribeDeviceActivations(appID string, devID string, handler ActivationHandler) Token {
	return c.SubscribeDeviceEvents(appID, devID, types.ActivationEvent, func(_ Client, appID string, devID string, _ types.EventType, payload []byte) {
		activation := types.Activation{}
		if err := json.Unmarshal(payload, &activation); err != nil {
			c.ctx.Warnf("mqtt: could not unmarshal activation: %s", err)
			return
		}
		activation.AppID = appID
		activation.DevID = devID
		// Call the Activation handler
		handler(c, appID, devID, activation)
	})
}
1100033
func (f *DefaultPooledObjectFactory) ActivateObject(ctx context.Context, object *PooledObject) error {
	if f.activate != nil {
		return f.activate(ctx, object)
	}
	return nil
}
953967
func (h *NetworkHandler) Enable(c *mech.HTTPDriverContext) {
	h.BaseHTTPDriver.Enable(c)

	h.C.Mux.HandleFunc("GET", "/v1/datapaths/{dpid}/network/interfaces", h.indexHandler)
	h.C.Mux.HandleFunc("GET", "/v1/datapaths/{dpid}/network/interfaces/{interface}", h.showHandler)
	h.C.Mux.HandleFunc("PUT", "/v1/datapaths/{dpid}/network/interfaces/{interface}", h.createHandler)
	h.C.Mux.HandleFunc("DELETE", "/v1/datapaths/{dpid}/network/interfaces/{interface}", h.destroyHandler)

	log.InfoLog("network_handlers/ENABLE_HOOK",
		"Network layer handlers enabled")
}
1206635
func (o *MockOracle) Enable() {
	o.Lock()
	defer o.Unlock()
	o.stop = false
}
285025
func deactivate(hostname string) func(http.ResponseWriter, *http.Request) {
	return func(w http.ResponseWriter, r *http.Request) {
		logEvent("deactivate")
	}
}
174720
func (c *Target) ActivateTargetWithParams(v *TargetActivateTargetParams) (*gcdmessage.ChromeResponse, error) {
	return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Target.activateTarget", Params: v})
}
1257534
func (remote *RemoteDebugger) ActivateTab(tab *Tab) error {
	resp, err := responseError(remote.http.Get("/json/activate/"+tab.ID, nil, nil))
	resp.Close()

	if err == nil {
		err = remote.connectWs(tab)
	}

	return err
}
1322261
func (b *BigIP) GetActivationStatus() (*Activation, error) {
	var a Activation
	err, _ := b.getForEntity(&a, uriShared, uriLicensing, uriActivation)
	if err != nil {
		return nil, err
	}
	return &a, nil
}
1233963
func (c *TodoController) BeforeActivation(b mvc.BeforeActivation) {
	// this could be binded to a controller's function input argument
	// if any, or struct field if any:
	b.Dependencies().Add(func(ctx iris.Context) (items []todo.Item) {
		ctx.ReadJSON(&items)
		return
	})
}
1213872
func (s *CreateThreatIntelSetInput) SetActivate(v bool) *CreateThreatIntelSetInput {
	s.Activate = &v
	return s
}
1277953
func Enable(id ID, when When, what Action) error {
	if v, ok := chaos[id]; !ok {
		return ErrNoEnt
	} else {
		v.Enabled = true
		v.When = when
		v.What = what
	}
	return nil
}